The error was not discovered until the man was arrested in recent weeks following a garda investigation into another serious offence.

He was subsequently charged with that offence and appeared before a district court sitting.

Now Justice Minister Dermot Ahern has ordered an inquiry to establish how the blunder took place and who was responsible for the error.

He has appointed the inspector of prisons, Judge Michael Reilly, to head the inquiry and has also asked him to make recommendations to ensure that a similar mistake cannot be made in the future.

Imprisonment

One of Judge Reilly's tasks will be to determine whether the prison authorities had been informed that the prisoner had been convicted of a second offence and given an additional term of imprisonment before he had completed his first sentence.

The decision to set up the inquiry was taken by Mr Ahern following consultation with Attorney General Paul Gallagher.

The name of the prisoner and details of the offences of which he was convicted or more recently charged cannot be disclosed at this stage for legal reasons.

He has since been returned to prison to serve his second sentence and is also facing fresh court appearances in connection with the new criminal charge.

The minister promised last night that Judge Reilly's report would be published, subject to any legal constraints, as soon as the man's trial on the new charge was completed.

But he said any recommendations submitted by Judge Reilly would be brought into effect as quickly as possible.

Mr Ahern said the investigation would involve all of the agencies that dealt with the issue in order to establish why the person was wrongly released.

He said he had been advised he could not disclose any details of the offences or the identity of the man as this would risk prejudicing his trial.