The Berlin market attacker, Anis Amri, has been shot dead by police in Milan.
The Tunisian criminal fired on police who asked him for ID during a routine patrol in the Sesto San Giovanni area in the early hours of Friday.
German authorities say fingerprints they provided have confirmed the dead man is Amri. They are trying to find out if he had accomplices.
Monday’s attack on a Berlin Christmas market left 12 people dead and 49 injured.
German Chancellor Angela Merkel said she was “relieved” that the attacker had been neutralised but added that Islamist terrorism was “a recurring threat to us”.
Her government’s main priority was to protect German citizens, she told journalists, adding that this case had raised “many questions”.
“Further changes to our laws and regulations will have to be made,” Mrs Merkel said at a news conference.
But leading Eurosceptics – including French National Front leader Marine Le Pen – have criticised open European borders, a result of the Schengen pact, for allowing a fugitive to move between countries.
Meanwhile, the self-styled Islamic State (IS) group has released a video showing Amri pledging allegiance to its leader, Abu-Bakr al-Baghdadi.
He does not make any reference to the Berlin attack, which IS claimed soon afterwards. It is not clear when or where the video was filmed.
Shortly before releasing the video, IS acknowledged Amri’s death in Milan.
When Italian police stopped the suspect, who was on foot, at 03:00 (02:00 GMT), he “immediately drew out a gun” and shot at the two policemen, Italian Interior Minister Marco Minniti said.
Officer Cristian Movio was injured in the shoulder but his injuries are not life-threatening.
His junior colleague, Luca Scata, who had been in the police for just nine months, was the one who fired the shot which killed Amri.
German officials found Amri’s fingerprints inside the truck that was used in Monday evening’s attack.
Federal prosecutor Peter Frank said the focus of the criminal investigation into the killings now was to establish whether Amri had had a network of supporters who helped him to plan and carry out the attack or to flee.
Investigators are also trying to establish whether the gun used in the shooting in Milan is the same weapon used to kill the Polish driver of the truck, who was found dead with stab and gun wounds in the cab.
The attack took place at a busy Christmas market at the Kaiser Wilhelm Memorial Church in the west of the German capital.AP The shootout took place in the Sesto San Giovanni area of Milan
According to the Italian news agency Ansa, Anis Amri travelled by train from France to Turin, and then took another train to Milan.
From the central station he travelled on to Sesto San Giovanni, a working-class area.BBC/GOOGLEPOLIZIA DI STATO Police officer Cristian Movio was injured in the shoulder in the shootout
Amri, a Tunisian national aged 24, had served a prison sentence in Italy after being convicted of vandalism, threats and theft in 2011.
He was known to Italian authorities for his violent behaviour while imprisoned.
After his release he was asked to leave the country. He later arrived in Germany where he applied for asylum in April of this year.
His application was rejected by the German authorities but they were unable to deport him to Tunisia because he had no valid identification papers.
Chancellor Merkel has talked with the Tunisian President Beji Caid Essebsi about the case.
“I told my Tunisian counterpart that we need to speed up the deportation process,” she told reporters.
Anis Amri was named as a suspect in the Berlin attack by German federal prosecutors, and a reward of up to €100,000 (£84,000; $104,000) was offered for information leading to his arrest.EPA Mourning continues at Breitscheidplatz in central Berlin, where the attack took placeAFP lorry’s Polish driver, Lukasz Urban, was found dead in the passenger seat
The German authorities issued an alert for Amri on Wednesday after immigration documents identifying him were found in the cab of the lorry used in the deadly attack.
Amri’s family had urged him to give himself up, and on Friday his mother criticised Italian and German security officials for not sending him back to Tunisia, where the rest of the family still live, in an interview with German broadcaster Deutsche Welle.
A spokesman for Germany’s interior ministry would not comment on reports in the German media that Amri had been filmed at a mosque in Berlin in the hours after the attack.
Separately, police arrested two people in the German city of Oberhausen on suspicion of planning an attack on a shopping centre.
Mr Minitti praised the two police officers who had apprehended Amri, and said the operation showed how Italy’s security system was working well.
“As soon as this person entered our country, a fugitive wanted across Europe, we immediately identified him and neutralised him,” the minister said.
German Interior Minister Thomas Maiziere said the case again highlighted the importance of close European and transatlantic co-operation in combating terrorism.
The end of the manhunt was not the end of the investigation, he said, as the authorities were still seeking Amri’s “network of accomplices”.
Mr de Maiziere added: “The terrorist threat facing Germany has not changed, unfortunately it remains high.”
Can police protect Christmas crowds?