A man with a low IQ has been banned from sex by a judge who said the case raised questions about civil liberties, The Telegraph newspaper reported.

The 41-year-old man, known as Alan, has an IQ of 48 and a moderate learning disability, the newspaper reported. Alan was living with a man and having sex with him.

His local council decided that his "vigorous sex drive" was not appropriate and he didn't understand what he was doing, the Telegraph reported.

High Court Justice Nicholas Mostyn agreed that Alan did not have the mental capacity to understand the health risks and should not have sex with anyone. The judge's order put Alan under the local authority that provides his housing.

Still, the judge called the case "legally, intellectually and morally" complex and said the court must "tread especially carefully" when the state tries to curtail such a basic human function as sex.

The case began in June 2009, when the local council started court proceedings to restrict Alan's contact with the man, identified as Kieron. Alan has been prevented since then from sexual activity, except when he's alone, the Telegraph's report said.

In Britain, the Court of Protection can make decisions for people deemed to lack the intelligence to make them themselves. These people can be ordered to undergo surgery, have abortions, be forced to use contraception — even have life support switched off.

Alan was described as "sociable" but “seriously challenged in all aspects of his mental functionality.” He had been accused of making lewd gestures at children, but no police action was taken, the Telegraph said.