document: The man, known only as Muhamed, told an Old Bailey jury he spent 10 months undercover in Birmingham.
  He named three men who allegedly tried to leave the UK hidden in a lorry.
  Anas Abdalla and Mahamuud Diini deny preparing for acts of terrorism. Separately, Gabriel Rasmus pleaded guilty to the same offence.
  The three men were arrested after they were found hiding in the back of a lorry at Dover docks last April, the jury heard.
  Muhamed, described only in court as a "law enforcement officer", is believed to be the first undercover operative to give open evidence in a criminal trial relating to Syria.
  He has also told the court how he spent months infiltrating alleged extremist networks across Birmingham.
  Muhamed said his objectives included identifying anyone planning to travel to Syria.
  The court heard his native language was Serbo-Croat and throughout his evidence - given from behind a curtain - he spoke quietly with an eastern European accent.
  Muhamed told the court that in June 2014 he was deployed to three Birmingham areas - Sparkhill, Sparkbrook and Small Heath.
  He then spent months building his "legend" - an undercover identity that people trusted.
  Rasmus, who is 29, from Birmingham and also known as Abu Junaid, was among the men he met - and he told the court that the perfume seller dreamt of going to Syria.
  Over the course of some months Rasmus repeatedly asked him for help in joining the self-styled Islamic State, revealing he had twice tried to travel and been turned back in Turkey.
  He showed Muhamed videos of hostage killings, praised the Charlie Hebdo attacks in Paris and asked him whether he had contacts in the Bosnian Mujahideen.
  "He is extreme, he is desperate to go to Islamic State and fight [for IS]," said Muhamed.
  The court heard that in January 2015, Rasmus expressed his frustration while walking with Muhamed in Birmingham's Bullring Shopping Centre.
  Rasmus wanted to join someone he knew in Syria - but he had no means to get there.
  "He was sad. He said if he would stay here, he would do something, some terrorist attack," said Muhamed.
  "Did he say what sort of terrorist attack?" asked Sally Howes QC, prosecuting.
  "He said something similar to what is happening in France," replied the officer.
  Ms Howes also asked Muhamed how he went about his work.
  "My objectives were to collect evidence and information about extremist behaviour and extremist people," he said, adding that his targets for finding such people would include meeting places, mosques and restaurants.
  "An undercover officer cannot act as an agent provocateur," he told the jury. "We cannot encourage people to do offences.
  "Undercover officers can show enthusiasm and interest. But you have to check your authorisation for [taking part in such activity]."
  Ms Howes asked Muhamed how he would decide which people he met were potential extremists.
  "If someone supports Islamic State, a terrorist organisation, that for me is terrorist and extremist behaviour, and I report it.
  "If someone showed me pictures of people killing hostages from Islamic State, that is extremist behaviour.
  "If someone wants to go there to fight for that terrorist organisation, that is extremist. If someone was thinking here of doing a terrorist attack, that is extremist behaviour."
  "If someone says British citizens or citizens from another part of the world is Kuffar [disbelievers], they hate these people and don't want to mix with these people. That is also extremist."
  Only the judge, jury, lawyers and defendants could see Muhamed during his evidence.
  Large screens and curtains were used to block the press and public from viewing the witness box.
  Somalia-born Mr Abdalla, 26, of Acocks Green, and Mr Diini, also 26, of Small Heath, deny preparing for acts of terrorism - and both say they have legitimate reasons for wishing to leave the UK in the back of a lorry.
  During the trial opening, Ms Howes told the jury that Mr Abdalla would say, in his defence, that his life in the UK had been made "intolerable" by the security service MI5 and the West Midlands counter-terrorism unit.
  "Mahamuud Diini has indicated that his purpose for leaving the UK was not to commit acts of terrorism but to discover the whereabouts of his brother, Ahmed Diini," she said.
  "Ahmed Diini had been arrested, detained and apparently tortured in an Egyptian prison. Following his release Ahmed Diini went to Turkey. According to Mahamuud Diini, the British security services had attempted to recruit his brother."
  The trial continues.
summary: An undercover officer who infiltrated alleged extremist networks told a court that a suspect threatened to attack the UK if he could not reach Syria.