A man accused of attacking a commuter with a knife at an east London underground train station said he was acting for Syria, a prosecutor told a London court on Monday.
Muhaydin Mire, 29, of east London, was charged with attempted murder in attacking a 56-year-old commuter from behind at the ticket gates of Leytonstone underground station on Saturday evening, Westminster Magistrates' Court heard.
Police are treating the incident as a terrorist attack.
The victim's injuries included a 12-cm (5-inch) cut to the neck that required five hours of surgery. A second person suffered minor injuries.
"It was a violent, sustained and unprovoked attack, during which the victim was punched, knocked to the ground and repeatedly kicked on the ground," prosecutor David Cawthorne told the court. "He said he was doing this act for Syria and his brothers in Syria."
The prosecution also said Mire's mobile phone had contained some terrorism-related images and material.
Wearing a gray t-shirt and gray tracksuit bottoms, Mire spoke only to confirm his name, age and address, and neither he nor his lawyer gave an indication of how he would plead to the charge. He was remanded in custody to appear at London's central criminal court, the Old Bailey, on Friday.
Britain is on its second-highest level of security alert, "severe", meaning a militant attack is considered highly likely, though not imminent, mainly because of the threat posed by Islamic State (IS) militants in Syria and Iraq.
Last week, British war planes joined air strikes for the first time against IS fighters in Syria.
"It's obviously a hideous attack," Cameron told reporters in Burton-on-Trent in central England where he was giving a speech.
"First of all, full credit to the person and people who took on this attacker, and full credit to the very brave police officers who managed to subdue him."
Footage of the aftermath of the incident has been published on social media and the phrase "You ain't no Muslim, bruv", which one onlooker is heard to shout, has been widely circulated.
"Let me also pay credit to the person - you can't quite see who it is - from the film who made that brilliant statement about 'You ain't no Muslim'," Cameron said.
After 130 people were killed in Paris last month in attacks claimed by the Islamic State militant group, police in London said they were working to double the number of officers able to carry firearms.
The authorities say British security forces have thwarted seven terrorist plots in the past 12 months and British Transport Police said that, since Saturday, they had boosted the number of officers and patrols on the London underground network.
Four British Islamists killed 52 people in suicide bombings on the capital's transport network in July 2005. The last militant attack occurred in May 2013, when two Muslim converts hacked a soldier to death in east London.