Conversations between prisoners and their lawyers have been accidentally recorded, justice secretary Chris Grayling admitted today.

The minister told the House of Commons in a statement that an investigation has found 32 instances where conversations between MPs and prisoners were recorded between 2006 and 2012.

He said there have also been a ‘small number’ of cases over the last few years where a call between the prisoner and their legal representative was recorded.

Graying said he has asked HM chief inspector of prisons, Nick Hardwick, to conduct an independent investigation into the recordings. This will assure the Ministry of Justice by the end of this month that safeguards are now in place, and report by early 2015 on the full facts and make further recommendations.

‘This is a serious matter, and I would like to start by apologising unreservedly to the House on behalf of the department for any interception of communications,’ said Grayling.

The justice secretary said the issue was first brought to his attention on 5 November and he had reported it to parliament at the earliest opportunity.

Grayling explained prisoners’ ability to phone and talk to family members, friends and others is an important part of the prison service’s work to help prisoners in maintaining family and other ties that support their rehabilitation.

He maintained it was important to ensure prisoners do not abuse the system to contact victims or by continuing their involvement in criminality while still in prison.

All prisons and youth offender institutions operate a PIN phone system and are informed that calls are, by default, recorded and may be listened to by prison staff. Prisoners must advise prison staff of their legal and other confidential numbers to stop these numbers being recorded.

However, communication between prisoners and their MPs or lawyers must be treated as confidential.

Grayling said there was ‘nothing’ to suggest listening into prisoners’ calls to MPs was intentional. Former justice secretary Jack Straw is among those found to have been affected.

‘That is not however to detract from the fact that confidential phone calls between members of this House themselves and their constituents in prison may have been recorded and monitored,’ he added.

‘It is unacceptable and I want to ensure that we have taken every reasonable step to protect the confidentiality of communications between prisoners and their constituency MPs.’