Anis Amri, the Tunisian-born suspect in the Berlin truck rampage that killed 12, was shot dead early Friday.

One Italian police officer was wounded in the encounter, although his injuries were not life-threatening, officials said.

A video surfaced of a man who appeared to be Amri pledging allegiance to ISIS leader Abu Bakr al-Baghdadi.

ROME — The suspect in the Berlin truck rampage was killed in a early-hour shootout after a chance encounter with police on the outskirts of Milan, according to Italian officials.

Italy's Interior Interior Minister Marco Minniti described how cops noticed a "man who walked suspiciously" at around 3 a.m. in Milan's Sesto San Giovanni neighborhood.

"When he was stopped, the man shot the policemen with a gun. The police shot back," Minniti told reporters at a press conference in Rome. One officer was wounded in the firefight.

Anis Amri German police via AP

The suspect, who police identified as Tunisian national Anis Amri, was "killed on the spot," said Minniti. The man killed was "without a shadow of doubt" the Berlin Christmas market attacker, he added.

German officials later confirmed that the man shot in Italy was Tunisian-born Amri.

The 24-year-old had been at the center of an international manhunt after authorities found his personal documents inside the vehicle that plowed through the Christmas market on Monday. Twelve people were killed and almost 50 others injured in the attack that has since been claimed by ISIS.

Minniti praised the young policeman who was wounded in the incident and whose injuries are not life threatening.

The man killed in Milan was "without a shadow of doubt" the Berlin Christmas market attacker, Italian officials stated Friday. Daniele Bennati / AP

"I thanked him for his bravery and professionalism shown," he said. "I thanked him on behalf of the head of police, of the Interior Ministry, and wished him a swift recovery."

Minniti added: "I told him that thanks to him, Italians will be able to have a happier holiday. All of Italy should be proud of him."

Complicated picture

On Friday, ISIS-affiliated news agency Amaq released a video of what it said was Amri's final will and a pledge of allegiance to the extremist group's leader Abu Bakr al-Baghdadi.

In the self-recorded video, he threatened attacks and called on Muslims to leave for jihad or strike at home. He did not reference Monday's attack in Berlin.

ISIS has claimed responsibility for the massacre in Berlin, saying one of its soldiers carried it out as part of the terror group's call to target people internationally.

A video has surfaced Friday of a man who appeared to be Anis Amri pledging allegiance to ISIS leader Abu Bakr al-Baghdadi. Amaq News Agency

A complicated picture has emerged of Amri in the days since the attack. He is thought to have arrived in Europe aged 19 and was jailed in Italy between 2012 and 2015 after reportedly setting fire to a school.

Italian prison officials told NBC News Friday that Amri had a “violent and unruly attitude” and was frequently moved between jails, but showed few signs of religious fundamentalism.

Italian authorities reportedly tried to repatriate Amri shortly after he was released from prison but Tunisia resisted these attempts.

He arrived in Germany in 2015, according to officials there, and was monitored as a potential risk by various authorities.

Related: Truck Suspect Trod Familiar Path to Terror

Yet surveillance by German officials produced "no leads" that suggested Amri was a threat to state security. The snooping operation against him was ended in September this year.

Amri maintained contact with his family back in Tunisia throughout this time, even sending presents in the days before the Berlin attack.

“He was going to return back to [Tunisia's capital] Tunis in January of 2017,” Amri’s younger sister Hamida told NBC News Thursday. “It is impossible that he killed those innocents. But if he was the one, he should be punished."

Other family members said Amri was far from religious while the German prosecutor’s office said earlier this week that he was a small-time drug dealer who was once involved in a bar fight in Berlin.

“I am in shock after hearing the news in the media,” said Nour Houdi, the suspect's mother. “My son is completely removed from religion. He used to drink alcohol."

“He [emigrated] to improve his situation and that of our family. He used to send messages to his brothers from the prison and used to call them after he left prison by Facebook and phone.

“The last communication was last Saturday. He sent a phone to his younger sister and some chocolate,” Houdi added.