A 15-year-old Hampshire boy with Asperger's syndrome was today locked up for an indeterminate period for luring an eight-year-old boy into a wood near Alton and raping him while taking photographs of the attack.

The teenager, who cannot be named for legal reasons, also sexually assaulted a 10-year-old boy and attempted to abduct a nine-year-old girl with the intention of having sex with her, Winchester Crown Court heard.

Richard Button, defending, told the court the defendant suffered from Asperger's syndrome, a condition on the autistic spectrum which means he has difficulty understanding other people's emotions.

He said: ''The symptoms are dislike of change, a preoccupation with patterns.

''In his case they are his preoccupation with farm machinery. Further symptoms he had are his interpersonal skills and, perhaps most importantly, an inability to see things from another's viewpoint.

''It is those symptoms, coupled with his sexual urges, that led to these offences.''

The judge, Mr Justice Irwin, told the defendant he was ''at significant risk of re-offending'' and was being locked up for the protection of the public.

He said: ''I find that you do represent such a risk. Time, care and treatment may reduce or abolish that risk but it is certainly present now.

''The impact of this offending on all three victims is considerable. One hopes they and their families will get the support they need and they will be able to recover.''

Mr Justice Irwin ordered that the teenager, who pleaded guilty at an earlier hearing to the charges of rape, sexual assault and attempted abduction, would be eligible to apply for parole after serving six years, but only if he was considered safe to be released.

The court heard that the defendant grabbed a 10-year-old boy close to Anstey Park in Alton on November 10 last year and put his hand over his mouth before telling him to take his clothes off.

When the boy refused, he asked him to take his trousers off and said he would rape him.

Nicholas Rowland, prosecuting, said: ''The boy at this stage was shouting, this scared the defendant off and as a parting shot he hit the boy to the head.''

He added that the boy was ''pale and shaken'' when he was taken home by two 13-year-old girls who found him.

His parents said in a victim impact statement that he had become more suspicious of strangers and his character had changed since the attack.

The other offences took place on December 4 last year when the defendant first followed a nine-year-old girl as she walked from school before asking her to follow him. She refused and ran off.

Mr Rowland said: ''If she had gone with him she also could have been subjected to a sexual assault of some kind as that was clearly what was in the mind of the defendant.''

He said the mother found her daughter crying and the parents said she suffered a delayed reaction to the attempted abduction, with nightmares starting earlier this year.

Mr Rowland said that half-an-hour later, the defendant took an eight-year-old boy to a den he had made in a thicket in woods next to the park.

He forced the boy to undress before he raped him and took photographs of the attack using a digital camera.

Mr Rowland said the victim's character had also changed as a result of the assault and, according to his parents, was less trusting of people now.

The court heard that when police arrested the defendant at his home they found the digital camera which had 12 photos of the attack on it as well as photos of his three-year-old niece undressed and a photograph of an unidentified eight-year-old girl.

Police also found a pair of shorts from his eight-year-old victim and four pairs of children's underwear.

Mr Rowland said: ''This is a disquieting feature of this case that those shorts were obtained by the defendant to take home.''

Officers also discovered the defendant had accessed websites with images of sexual violence and had printed out some of the indecent images he had taken with his digital camera.

Mr Button said the defendant had the ''normal'' sexual urges of a teenage boy but his condition meant he was unable to express these urges in a conventional way and had led him to carry out the attacks.

He added: ''The tragedy is that he doesn't know how to prevent it happening again.''

Mr Justice Irwin placed the defendant on the sexual offender's register and banned him from working with children.

He also banned him from being alone with children or communicating with minors without permission and banned him from using a digital camera unless for education purposes for five years.

He was also banned from accessing child pornography websites as well as fetish sites depicting rape or incest.