The final internet chatroom exchange took place on 28 June last year. "U want me 2 take him 2 trafford centre and kill him in the middle of trafford centre??" said one message. "Yes," came the reply.

Less than 24 hours later, a 14-year-old boy was critically ill in hospital with stab wounds in the chest and stomach. At first it seemed as though a brutal, but straightforward, robbery had gone wrong. But yesterday the young "victim" became the first person in this country to be convicted of inciting their own murder.

An intricate web of deceit had been spun by the boy on the chatroom to recruit another teenager as his would-be killer.

"This case serves as a stark warning of the dangers of the dark side of the internet," Nicholas Clarke, prosecuting, told the court yesterday.

The boy - who is now 15 and can be referred to only as John for legal reasons - persuaded his friend, known as Mark, now 17, to stab him to death in order to pass a fictitious initiation test for the British secret services in a meticulously planned attack one Sunday evening last summer.

John, from Greater Manchester, pleaded guilty at Manchester crown court to incitement to murder and perverting the course of justice.

He was given a three-year supervision order, banned from contacting Mark or using the internet without strict adult supervision.

Mark, who is also from a middle-class family in Greater Manchester, was given a two-year supervision order for attempted murder.

Judge David Maddison, the recorder of Manchester, said: "Skilled writers of fiction would struggle to conjure up a plot such as that which arises here. It's staggering to be dealing with a case that arises out of a 14-year-old boy's invention of false personalities, false relationships and events arranged for his own killing at the hands of a 16-year-old boy who he had met via an internet chatroom."

He said that under normal circumstances, the offences committed would have resulted in extremely lengthy custodial sentences. "But these could not be described as any normal circumstances," the judge added.

The attack left John, a promising grammar school student, close to death. One of the stab wounds pierced his kidney and lacerated his liver. His gall bladder had to be removed and he remained critically ill in hospital for a week.

Mark had been fooled by John into believing he was working for the British secret services. He was expecting to meet the prime minister, and be given a gun and up to £500,000 in cash.

At first, the police thought the attack was committed by an adult robber described in precise details by Mark. Detectives made appeals for help through the local media for the apparently unprovoked attack in Altrincham town centre.

But when officers examined CCTV footage they realised the story was implausible. It showed Mark and John had disappeared down the alleyway - alone - for 25 minutes.

From his hospital bed, John said he had been stabbed by Mark but "he didn't know why". In July last year, Mark was charged with attempted murder.

But when it emerged that the boys had met through a teenage chatroom, detectives examined their computers.

A criminal intelligence analyst, Sally Hogg, pored over 58,000 lines of text generated between them in six weeks. Police were able to link all the fictional characters back to John because Ms Hogg's analysis discovered common features in the typing style, such as the misspelling of "maybe" as "mybye", of all the characters.

Detective Chief Inspector Julian Ross, of Greater Manchester police, said: "The initial contact was made when the older boy went into an internet chatroom and talked to a person purporting to be a 16-year-old girl. That girl was in fact the younger boy."

"She" then introduced him to her stepbrother, who was John.

Mr Ross said: "The older boy thought he was talking to five or six different people when he was in fact talking to the younger boy all along."

The crucial character in the deception was a 42-year-old British secret agent called Janet. Mark was told by her that he must commit various tasks and that John was dying from a brain tumour.

Then on June 28 Janet told Mark that he had to kill the younger boy. If he carried out the job successfully, he was told, he would be accepted as a spy.

"Could you stab someone?" Janet asked Mark in the final chatroom exchange.

"I haven't really thought about it," Mark replied.

Janet: "Well think please."

Mark: "OK"

"Everything was planned out the previous day," said DCI Ross. "It is a tragic event that a 14-year-old boy would try to have someone kill him."

The bleakly serious nature of the case is expected to lead to calls for tighter monitoring of internet chatrooms. Belinda Sproston, of the parental control software firm CyberPatrol, said: "The conversations that these boys were having would not have been allowed in a monitored chatroom."