A paedophile has been jailed for at least four years after admitting four child sex offences.
Keith Morris told police he had "a problem with children"
Keith Morris, 46, of Ilsington, Newton Abbot, Devon, was released on bail by an Exeter Crown Court judge last month, sparking a row over jail overcrowding.
It followed Home Secretary John Reid's request to judges to jail only the most dangerous and persistent criminals.
Morris was arrested after complaints were made about his sex activities with a teenage boy at a house in Torquay.
He admitted at an earlier hearing to three offences of causing a person under 16 to engage in sexual activity without consent and one offence of sexual activity with a child under 16.
Judge Graham Cottle jailed Morris for an indefinite period. He will be held for a minimum of four years before the authorities will consider whether it is safe to release him.
Judge Cottle's decision to release Morris on bail last month raised accusations from MPs that it was putting the public at risk.
But the judge hit back on Friday, saying it was quite right for judges to be reminded that they had a duty to help avoid prison overcrowding, as long as they did not expose the public to extra risk.
He told Morris: "There was never any prospect that you would pose a risk if released on bail with appropriate conditions."
Morris had been on a curfew between 0800 and 1700 while he was on bail.
Judge Cottle also criticised local MPs, who he said had made "ill-informed" comments on the case.
In a Parliamentary debate Torbay MP Adrian Sanders accused Judge Cottle of "playing politics" over the decision to release Morris on bail.
Judge Cottle said the indeterminate sentence meant that Morris would remain in jail "until the necessary work has been completed by you to address the risk that you currently pose".
"You will only be released when it is deemed safe to do so".
'Clearly a danger'
Mr Sanders denied making ill-informed comments on the case.
He said: "If the offences were serious enough to merit a four-year sentence then they were serious enough to warrant custody before sentence.
"He was clearly a danger to the public."
Morris has previous convictions for sex offences against young boys and admitted to police that he had a problem with children and was attracted to young boys.
In 1980 Morris was convicted of indecent assault on a 14-year-old boy and gross indecency with a 10-year-old boy. He was then jailed for six months.
In 1989 he was convicted of indecent assaults on boys aged six, eight and 10. On that occasion he was jailed for 30 months.