Three Syrian refugees in Germany overpowered a bomb suspect who gave elite commandos the slip and sparked a two-day manhunt, police have revealed.
Police believe Jaber al-Bakr, also a Syrian, was planning a bomb attack and had links to so-called Islamic State.
They failed to arrest him on Saturday and found 1.5kg of explosives in his flat in the eastern city of Chemnitz.
He made his way south to Leipzig and sought help from fellow Syrians, who then handed him to police.
Details of the role of the three Syrians emerged slowly as police feared they could be at risk of reprisal.
The suspect approached one of the Syrian refugees at Leipzig's main railway station and asked him if he could sleep at his apartment, German media report.
Although aware of who he was, the man took the suspect back to his flat in the Paunsdorf area of north-eastern Leipzig where he and his flatmates overpowered him.
Saxony police chief Joerg Michaelis said they had heard about the manhunt and tied him up while one of them knelt on him.
One of the three then took a picture of the suspect on a mobile phone and travelled to a police station 20km (12 miles) away in the opposite end of the city.
Shortly after midnight on Sunday anti-terror commandos arrived at the flat and detained Jaber al-Bakr.
Why did he give police the slip?
Intelligence officials had apparently been watching Jaber al-Bakr for several months. He arrived in Germany illegally in February 2015 and was given refugee status. According to his Syrian passport, he was born in a Damascus suburb in January 1994.
German intelligence apparently had reports last week that he might be planning such an attack, and they alerted police in the eastern state of Saxony.
They found out on Thursday that he had used the internet to get bomb-making instructions and had obtained explosives.
On Friday, anti-terror police began watching a flat in a run-down residential area of Chemnitz called Fritz Heckert. They were preparing to storm it when Mr Bakr managed to slip away at 07:04 on Saturday.
Defending their actions, police chief Mr Michaelis said they "were not certain if that person was Bakr.
"He was told to stop, but he then ran off, police fired a warning shot, but they could not shoot at him because there were other people around.
"At dawn the police were visible - so they had to get into the flat as soon as possible," he said. People were evacuated from neighbouring flats and police used explosives to get in quickly, he said.
Germany's two-day terror alert
The alarm was raised immediately, with appeals over radio, TV and, importantly, police spread the message over the internet in English and Arabic.
Little was confirmed initially, but there were unconfirmed reports that the suspect may have been targeting a Berlin airport.
Police raided two more flats in Chemnitz and arrested more suspects, mounting extra security checks at railway stations and airports.
But there were no sightings and the suspect made his way to Leipzig station, 85km (50 miles) north of Chemnitz.
After he was overpowered by the three other Syrians, a special commando unit and the bomb squad moved in.
"Tired but overjoyed: we captured the terror suspect last night in Leipzig," the police said in a tweet.
How serious was the threat?
German officials identified the explosives found in Chemnitz as TATP, a home-made explosive used in the deadly jihadist attacks in Paris last year and in Brussels last March. It was, said police, "extremely dangerous".
"The methods and behaviour of the suspect suggest an IS context," said Saxony State Police chief Joerg Michaelis.
"It is reasonable to assume that an explosives belt was nearly ready, or had been prepared already," he said.
IS has claimed it inspired two terror attacks in Bavaria, southern Germany, in July.
A Syrian man wounded 15 people when he blew himself up at a music festival in the town of Ansbach. A few days earlier, a teenager attacked passengers on a train with an axe, wounding five people.
Police have warned that a small number of jihadists may have come into Germany with the influx of more than a million irregular migrants last year.
However, there are fears of a backlash from the far right and the anti-migration Alternative for Germany has surged in popularity, particularly in eastern areas such as Leipzig and Dresden.
"We're happy that not all foreigners are the same," an elderly couple in Leipzig told German news agency DPA.
Saxony Prime Minister Stanislaw Tillich praised the three Syrians who overpowered the suspect as "courageous and responsible". The trio have been described as witnesses and local police are still trying to check whether they already knew the man.