A 12-year-old boy who raped his teacher and then stole her car was today detained for life.

The schoolboy attacked the woman as she sat next to him during a one-to-one teaching session. Afterwards, he took her car and drove it for 30 miles before dumping it in Gateshead on Tyneside.

The boy, who has severe learning difficulties, admitted at an earlier hearing that he had raped the teacher at a special needs centre in County Durham and then stolen her car in November 2004.

Today at Teesside Crown Court, Mr Justice Grigson ordered the boy, who cannot be named for legal reasons, to be detained for life. The child is one of Britain's youngest convicted rapists.

The judge told the boy, who is now 13: "These problems are not of your own making but it is plain that until these problems are dealt with you are very likely to commit other offences, other offences as serious as this, so the public has to be properly protected until such time as your problems have been assisted." Mr Justice Grigson said he was prescribed by law to set a minimum sentence that the defendant should serve before being considered for parole. He told the boy that he must serve at least 21 months but warned him it was likely he would serve much longer.

"You have admitted a very serious offence," the judge said. "You attacked a young woman, a very young woman who had done you no harm, indeed whose only intention was helping you overcome your particular problems.

"She was a very young woman who had her whole life ahead of her. You raped her. You attacked her in a sexual way, which was a very serious offence."

He told the defendant, who sat at the back of the courtroom accompanied by three minders rather than in the dock, that the woman's mental scars would take a very long time to heal.

Mr Justice Grigson added: "You know that better than anybody - you were the victim of such an attack. Despite your very young age, it is quite clear that you knew what you were doing. You waited until there was nobody in the building. She did not want you to do it but she was terrified of you."

Shaun Dodds, prosecuting, told the court that the schoolboy, who lived in Darlington, received full-time one-to-one sessions with the teacher at a special needs centre in the county.

He waited until they were alone in the building before the boy jumped up from a desk where he was working and attacked the teacher as she sat on a sofa. Mr Dodds said: "She describes a wild look in his face. The complainant was trying to calm him down and stop him and was asking him why he was doing this."

The schoolboy, who is 5ft 3in and stocky, then raped the woman, who is 5ft 1in. The court was told that after the attack the teacher, who is in her 30s, locked herself in a lavatory and called police on her mobile.

The boy, meanwhile, took the keys to her £21,000 car and drove at least 30 miles to Gateshead before abandoning it. He was finally caught by police in the town.

John Evans, defending, said his client had been the victim of sexual and physical abuse from a very young age.

"The court is dealing with a boy born in 1991 whose parents separated in 1993," Mr Evans said. "By January 1995, when he could only have been three and a half years old, concerns were being expressed about his sexualised behaviour.

"Even at that age his GP expressed concern that he was under the influence of illicit substances. By 1995, when this boy could not yet have been four, he was being mistreated and indeed encouraged to engage in misuse of alcohol and cigarettes.

"Some might say that the signs were already there and that he was being significantly let down."

But the barrister added: "Hopefully there will come a time when he is no longer the risk he currently is and can be released back into the community."

Until September 1993, there was common law presumption that a boy aged under 14 years was incapable of sexual intercourse. Since the law was changed, convictions of boys under 14 for rape have been rare.