German chancellor Angela Merkel has expressed her relief that the suspect in the Berlin truck attack poses no further threat after he was shot dead by Italian police in Milan.
Mrs Merkel said she has ordered a comprehensive investigation into all angles of the case, after it emerged that German authorities had tracked 24-year-old Tunisian man Anis Amri for months this year on suspicion of planning an attack.
The German leader said "our democracy, our rule of law, our values and our humanity" are the alternatives to "the hate-filled world of terrorism", and would ultimately prevail.
Mrs Merkel also expressed her deep thanks to Italian authorities, and in particular to the two police officers who challenged Amri.
Twelve people were killed and 48 others were injured after a truck was driven into a Christmas market in the German capital on Monday evening.
Amri was killed early on Friday in a shoot-out with police during a routine patrol outside a train station in Milan.
He was stopped by two officers during a routine patrol in the Sesto San Giovanni area. He pulled a gun from his backpack after being asked to show his identification and was killed in an ensuing shoot-out.
One of the officers, Christian Movio, 35, was shot in the right shoulder. He underwent surgery for a superficial wound and is said to be in good condition. Mr Movio's 29-year-old partner, Luca Scata, fatally shot Amri in the chest.
Italian police said the suspect had travelled from Germany through France and into Italy after the attack, with some of the journey taken by train.
French officials refused to comment on his passage through France, which has increased surveillance on its trains after recent attacks and the Berlin massacre.
Italian premier Paolo Gentiloni praised the two young police officers for their courage in taking down Amri during a routine check of ID papers while he was alone outside the deserted station.
He also called for greater cross-border police cooperation, suggesting some dismay that Europe's open border policy had enabled Amri to easily move around, despite being Europe's number one fugitive.
Amri was identified with the help of fingerprints supplied by Germany.
"The person killed, without a shadow of a doubt, is Anis Amri, the suspect of the Berlin terrorist attack," said Italian interior minister Marco Minniti.
Islamic State (IS) has claimed responsibility for Monday's attack outside Berlin's Kaiser Wilhelm Memorial Church.
Mrs Merkel said: "We can be relieved at the end of this week that one acute danger has been ended.
"But the danger of terrorism as a whole remains, as it has for many years - we all know that."
Milan, Rome and other cities have been on heightened alert since the attack, with increased surveillance and police patrols.
Amri's death does not reduce the terrorist threat to Germany, the country's top security official said.
The threat "remains high" and security won't be scaled down, interior minister Thomas de Maiziere said.
He said the two Milan police officers "did excellent work and acted with great bravery".
Germany's chief federal prosecutor, Peter Frank, said his office is in contact with Italian authorities to establish what route Amri took.
Prosecutors also want to know whether the gun Amri was carrying in Milan was the same one used to shoot the Polish driver of the truck he had commandeered for the attack, Mr Frank added. The driver was found dead in the vehicle's cab.
A Milan anti-terrorism official said investigators also are working to determine what contacts, if any, Amri had in Milan. There is no evidence he ever passed through Milan during his previous stay in Italy, where he spent time after leaving Tunisia in the wake of the 2011 Arab Spring uprisings.
Amri served three and a half years in Italy for setting a fire at a refugee centre and making threats, among other things - but authorities apparently detected no signs that he was becoming radicalised. He was repeatedly transferred among Sicilian prisons for bad conduct, with prison records saying he bullied inmates and tried to spark insurrections.
His mother said he went from there to Switzerland and then to Germany last year.
Authorities in Germany deemed him a potential threat long before the Berlin market attack, and even kept him under covert surveillance for six months this year.
Authorities said he has used at least six different names and three nationalities in his travels around Europe.
They had been trying to deport him after his asylum application was rejected in July but were unable to do so because he lacked valid identity papers, and Tunisia initially denied that he was a citizen.
Mrs Merkel said she had spoken with Tunisian president Beji Caid Essebsi and told him that the repatriation of Tunisians who are not entitled to residency in Germany needs to be stepped up.
Mr Essebsi firmly condemned the "cowardly terrorist act" in Berlin and called for tighter cooperation to fight "the plague of terrorism that threatens the security and stability of all countries and all societies".
A video later released by IS appears to show Amri pledging allegiance to its leader Abu Bakr al-Baghdadi and vowing to fight against "the Crusader pigs".
The video, which seems to have been taken by Amri himself, shows him standing on a footbridge in the north of Berlin, not far from where he allegedly hijacked the truck used in the attack.
The site is just a few hundred yards from a Berlin state administration office which deals with asylum matters.
It is unclear whether Amri's case was handled there or whether the video, released online on Friday, was taken before or after the attack.