A Muslim convert today pleaded guilty to a failed suicide bomb attack that had been intended to kill as many people as possible at a city centre restaurant in Devon.

Nicky Reilly, who changed his name to Mohammed Rashid Saeed-Alim after converting, admitted the failed attack, which happened at the Giraffe restaurant in Exeter at lunchtime on May 22.

The 22-year-old attempted to put together three homemade liquid bombs while in a toilet cubicle but one of them blew up in his hands.

Counter-terrorist police are searching for two men they believe encouraged Reilly, who has a history of mental illness, via an extremist website.

Reilly, appearing at the Old Bailey via a video link, admitted attempting to murder and using the internet to research how to make bombs using caustic soda, paraffin, nails and soft drinks bottles.

The senior prosecutor, Stuart Baker, said Reilly told police he wanted to kill himself and as many people as possible.

"He [said] he intended to martyr himself and to kill others in the restaurant," Baker said.

"In his words, this was in retaliation for the oppression of Muslims around the world and in relation to world events of recent years."

Reilly suffered serious burns to his face and arms after one of the bombs exploded in his hands as he tried to assemble it.

A CCTV camera recorded him staggering from the restaurant before he was arrested. Dozens of customers dining metres away from the toilet cubicle escaped unhurt.

The judge, Mr Justice Calvert-Smith, said Reilly had considered a number of targets in Plymouth before choosing the restaurant.

"It was only in early 2008 that he began to conduct research ... including the purchase of a suicide vest," Calvert-Smith said.

"He reconnoitred a number of other places including a police station, a shopping centre and the Devonport dockyard."

Calvert-Smith said Reilly had been influenced by other people, who have not been identified.

"He was in frequent touch with apparently two other people ... with whom he discussed his plans and from whom he received a certain amount of encouragement and information over the internet.

"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.

"In the end, the decision was made to target ordinary citizens in a restaurant."

The court heard that Reilly travelled into the centre of Exeter with the unassembled bombs in a rucksack. He bought a drink in the restaurant before going into the toilet cubicle shortly afterwards.

Police said they believed the devices could have been powerful enough to blow out the building's glass front.

Baker told the court Reilly had intended to assemble all the bombs before running into the restaurant, but got locked in the toilet cubicle just before the first bomb exploded.

"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," he said.

A police search of the would-be bomber's house revealed a suicide note quoting Osama bin Laden and calling on Britain to get out of Iraq and Afghanistan.

Sources said counter-terrorist police had been aware of Reilly and suspected he had loose links to known Islamic extremists.

The Devon assistant chief constable, Debbie Simpson, said the two people who had been communicating with Reilly – who has Asperger's syndrome – were believed to be abroad.

She said the attempted bomber had been treated as a vulnerable adult during police interviews.

Reilly's mother, Kim, with whom he lived at the time of the attack, wept in the public gallery above the court as she watched him on the video link.

She has previously said her son's special needs made him an easy target for extremists.

Two further charges related to explosives were dropped by the prosecution after Reilly admitted the more serious charge of attempted murder.

Reilly, who is being held at Belmarsh prison in south-east London, is expected to be sentenced in November.