Jeffrey Goodwyn has been released after a judge said he 'no choice' but to quash his original sentenceGetty

A "very dangerous" paedophile has been released from prison after a judge ruled his open-ended imprisonment for public protection (IPP) sentence was "unlawful".

Jeffrey Goodwyn, 48, was jailed in January 2012 for indecently assaulting a seven-year-old girl having already been convicted of raping a nine-year-old girl.

Described as a "very dangerous offender indeed" who was a serious risk to children because of his violent and paedophilic tendencies, the judge gave him an IPP sentence which allows offenders to be locked up indefinitely until they can show they are no longer a danger to the public.

However, Goodwyn has now been released after lord chief justice Thomas ruled the sentence was unlawful as IPPs can only be handed down for offences which occurred after April 2005, with Goodwyn's offences occurring at least a year before that.

He has been released despite his own lawyers admitting he has made "no progress whatsoever" towards his rehabilitation while in prison and refused to discuss his offending. He has also been punished for threatening staff and for fighting other inmates.

Lord Thomas said: "This applicant remains a very dangerous man.

"Because of his failure to engage with the relevant assistance available to him in prison, he has not begun to address his offending."

"Unhappily, despite the danger to the public which this applicant clearly represents, we are in no doubt that... the IPP was unlawful."

Goodwyn was handed a new three-year custodial sentence, which he has already served, followed by five additional years on licence.

South Wales Police have refused to release a photograph of Goodwyn over fears for his safety.