Anis Amri, a Tunisian, lived in Germany for more than a year, despite having been previously jailed in Italy and denied asylum in both nations. Even as Europe’s most-wanted man, he traveled hundreds of miles this week, crossing at least two European Union borders on his way to Italy, where police stopped him to check his identity.

Chancellor Angela Merkel responded to mounting pressure Friday over her approach to migrants and national security as she readies for a re-election battle next year.

“The Amri case raises a series of questions, not just about the deed itself but also about the time since he came to Germany,” she said. “We will now examine with urgency to what degree state practices must be changed.”

Police in multiple countries were working Friday to figure out how Amri, who authorities said had train tickets from France, made his escape and whether he had help.

“I am very relieved that there is no more danger stemming from this perpetrator,” German Interior Minister Thomas de Maizière said, but he added that authorities would continue hunting for any accomplices. As of late Friday, police hadn’t disclosed any additional arrests.

Islamic State claimed responsibility for the attack. The terror group’s official Amaq news agency posted a video of a man it said was Amri urging followers to kill “crusaders.” The man strongly resembled photos of Amri released by German police.

Berlin attack suspect Anis Amri arrived in Europe in 2011. Since then, authorities in Italy and Germany have tried multiple times to send him back to Tunisia. They failed.

German authorities have come under heavy criticism for failing to stop Amri. He was flagged as having been radicalized, but the country’s overtaxed security services dropped intensive surveillance of him earlier this year after failing to find enough evidence to make him a high-priority target.

Ms. Merkel said her government would “quickly agree on and implement” any necessary legal or policy changes, repeating vows to speed up deportations of migrants whose asylum claims have been denied. Her statement struck a new tone of flexibility from a leader who has forcefully defended her approach to migration and security. But the chancellor didn’t signal a shift in her positions that Germany wouldn’t cap the number of refugees it takes in and that Europe’s internal borders should be open.

In 2015, Ms. Merkel declined to close Germany’s borders to refugees and migrants even as thousands of people a day streamed into the country, especially from war-torn Syria. She argued that stopping them would cause widespread suffering and potentially destabilize southeastern Europe. Her critics say the move left a dangerous opening for radical Islamists to enter.

The challenge authorities face as they screen new arrivals is daunting. At the end of November, authorities say, there were nearly 33,000 asylum seekers in Germany just from Tunisia, Amri’s country of origin. Decisions had been made to repatriate 1,500 of them, but only 111 had actually been returned to Tunisia.

One reason is Tunisia’s reluctance to take the people back. Ms. Merkel on Friday called Tunisian leader Beji Caid Essebsi and urged him to help. “I told the president that we must still significantly accelerate the repatriation process,” she said.

Such moves may not be enough to assuage Ms. Merkel’s political opponents.

“The state has failed,” Karsten Woldeit, a lawmaker for the anti-immigrant Alternative for Germany in Berlin’s state legislature, said after a hearing on the attack on Friday. “It’s almost as though the coordinated protection of the citizenry is politically undesirable.”

Amri’s case has been especially embarrassing for the authorities. After serving nearly four years for arson in an Italian prison, he came to Germany in summer 2015.

Soon after he arrived, investigators noticed he was making contact with known Islamist radicals. He appeared to research how to build a pipe bomb online and seemed interested in obtaining automatic weapons through a contact in Paris, a Berlin government official, Torsten Akmann, said Friday.

But none of the clues were solid enough to stand up in court, officials say. Berlin prosecutors stopped monitoring him in September. By early December, he had slipped the gaze of German intelligence officials still trying to keep tabs on him.

On Monday, authorities say, he rammed a stolen truck into the crowded Christmas market and killed 12 people. He fled the scene, and police didn’t find his wallet in the truck until the day after the attack.

Despite the intensity of the manhunt, Amri succeeded in reaching Italy via France, Italian police said. They said he was carrying several hundred euros in cash, a small knife and a train ticket from the southeastern French town of Chambéry to Italy.

French officials are checking video footage to figure out if he took that train and if so how he got there. “We still have only a vague idea of what happened,” said Luc Poignant, a spokesman for a police officers’ union.

After arriving in Turin at about 9 p.m. Thursday, Italian police said, Amri made his way to Sesto San Giovanni, north of Milan, where police stopped him just after 3 a.m. When two officers approached and asked for identification, he became agitated, pulled out a .22-caliber gun and began to shoot, shouting “Bastard police!” in Italian.

German Chancellor Angela Merkel expressed relief that the Tunisian truck-attack suspect had been shot and killed, adding, “Germany and Tunisia have significantly intensified their cooperation in the fight against terrorism.”

The police said they returned fire, killing him. One officer received non-life-threatening injuries in the shootout. Fingerprints identified the dead man as Amri “without a doubt,” Italian Interior Minister Marco Minniti said.

Officials said they didn’t know if the gun Amri had was the same one used to shoot the Polish driver found dead in the truck that plowed through the market. Also unknown are Amri’s motives for coming to Italy. Sesto San Giovanni, an industrial area, is home to a large foreign-born community, including many Muslims drawn over the years to jobs in heavy industry, and authorities are investigating whether Amri traveled to Italy to meet someone. “It is among the many hypotheses that we are looking at,” said Antonio De Iesu, Milan’s police chief.