A Muslim convert has admitted launching a failed suicide nail-bomb attack on a Devon restaurant.
Nicky Reilly, 22, pleaded guilty at the Old Bailey to attempted murder at Exeter's Giraffe restaurant on 22 May.
Reilly, from Plymouth, had been preparing the attack when a bomb went off in his hands in a toilet cubicle.
Police believe Reilly, said to have learning difficulties, was "preyed upon and radicalised by others". He will be sentenced on 21 November.
The court heard counter-terrorism police were still hunting two unidentified people who encouraged Reilly after contacting him via an extremist website.
The judge, Mr Justice Calvert-Smith, said: "There is evidence from materials seized that he became increasingly drawn to violent action in support of fellow Muslims in revenge for perceived persecution, and to the idea of himself personally becoming a martyr."
CCTV footage showing the moment of the failed suicide bomb attack
The judge said Reilly, who appeared in court under the name Mohammad Rashid Saeed-Alim, had also considered targeting a Plymouth police station and Devonport dockyard.
Detectives believe Reilly was groomed by extremists he met near his home in King Street, Plymouth.
"He was preyed upon, radicalised, and taken advantage of," said Deputy Chief Constable Tony Melville.
Reilly's mother Kim also said he was an "easy target, easy prey" for radicalisation.
She said he would have had instructions or guidance from someone, as he was thought to have a mental age of 10 and suffered from mental illness.
But Assistant Chief Constable Debbie Simpson said investigators did not think anyone else had helped him physically assemble the bombs.
Reilly, who was treated as a vulnerable adult during police interviews, converted to Islam in 2002 or 2003, attending various mosques in Plymouth, she said.
The two people who contacted Reilly through his YouTube page are thought to be overseas and police continued to hunt for them, she said. She declined to comment on suggestions they might be in Pakistan.
There was "no doubt" Reilly's intention "was to kill and seriously injure many innocent members of the public in the Giraffe restaurant in Exeter", ACC Simpson said.
Mr Justice Calvert-Smith told the court Reilly had begun to prepare for the attack in early 2008 and had bought a suicide vest.
During this time, Reilly was in frequent touch with two unidentified people, with whom he had discussed his plans and received a "certain amount" of encouragement, the judge said.
"There was some debate, which is revealed by comments on the computer, about what sort of person should be targeted in due course, whether public servants, such as police officers, or other public servants or ordinary citizens," he said.
"In the end the decision was made to target ordinary citizens in a restaurant."
One of Reilly's improvised bombs
The court heard Reilly made the bombs in glass bottles, one using caustic soda and the other kerosene, which he then filled with about 500 nails.
He travelled to Exeter by bus on the morning of 22 May with six bottles, three of which contained caustic soda, and three kerosene and another chemical contained in drain cleaner, the judge said.
"As he prepared the caustic soda devices in the toilet of the restaurant, they began to explode. He was subsequently, as the world knows, arrested and injured himself."
Reilly had planned to run into the restaurant holding three bombs to his stomach, but the first one reacted prematurely and he could not get out, the court heard.
According to police, there were 24 customers and 11 members of staff in the restaurant at the time.
Prosecutor Stuart Baker said: "His recollection now is that he was unable to open the lock of the cubicle door and come out, by which time the first device had already exploded."
Appearing in court via a video link, Reilly pleaded guilty to attempted murder and preparing a terrorist attack.
Kerim Fuad, defending, told the judge he wished to present a statement and a psychiatric report to the court.
Reilly's mother Kim was devastated when she found out about the bombing
He said: "There is much I wish to advance on behalf of this defendant's unusual and complex personal background which led to this ugly and dangerous incident."
Reilly's mother wept in the public gallery above the court as she watched her son on a plasma screen.
He was remanded in custody until sentencing at the Old Bailey.
Three other men arrested in connection with the investigation have been released without charge.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.