He was the man nobody wanted.

When Anis Amri washed up on European shores in a migrant boat in April 2011, he landed on the windswept Italian island of Lampedusa already a fugitive. Sought in his native Tunisia for hijacking a van with a gang of thieves, the frustrated Italians would jail him for arson and violent assault at his migrant reception center for minors on the isle of Sicily.

There, his family noted, the boy who once drank alcohol — and never went to mosque — suddenly got religion.

He began to pray, asking his family to send him religious books. The Italian Bureau of Prisons submitted a report to a government ­anti-terrorism commission on Amri’s rapid radicalization, warning that he was embracing dangerous ideas of Islamist ­extremism and had threatened Christian inmates, according to an Italian government official with knowledge of the situation. The dossier was first reported by ANSA, the Italian news service.

The Italians tried to deport Amri but couldn’t. They sent his fingerprints and photo to the Tunisian consulate, but the authorities there refused to recognize Amri as a citizen. The Italians, officials there say, could not even establish his true identity. Italy’s solution: After four years in jail, they released him anyway — giving him seven days to leave the country.

On Monday, German authorities believe, Amri, now 24 and with previously known links to Islamist extremists, drove the truck that slammed into a Christmas market in Berlin, killing 12 and wounding dozens. They had tried to deport him, too, though Tunisia long refused to take him back.

The night before the attack, Amri called his family in Tunisia, as he would nearly every weekend. His birthday — on Thursday — was fast approaching, and he seemed animated.

“What’s the weather like? Is it raining? What are you having for dinner?” his sister, Sayida Amri, 36, in his bleak home town of Oueslatia, Tunisia, recalled him asking Sunday. He asked her, she said, to pass the phone to his youngest niece, Zeinab — 4 years old.

“Do you even know who I am?” he asked her.

His case suggests two critical realities of modern terrorism that present major new challenges, especially in Europe. The cumbersome, sometimes flawed system of deportation and asylum — mixed with open borders — has made it exceedingly easy for radicalized Islamists to operate on the continent.

Yet Amri is also the latest suspect to have emerged from a disconcerting counterterrorism gap in both Europe and the United States.

46 years of terrorist attacks in Europe, visualized

In case after case — including that of the German Christmas market attack — authorities have come forward after the fact to say that they had enough cause to place the suspect under surveillance well before the violence. But never enough to move in for an arrest.

This has been true of the majority of lone-wolf terrorism plots over the past several years. The Orlando shooter, Omar Mateen, had been under FBI investigation for 10 months.

The bureau had also tracked but had been unable to build a case against the Boston Marathon bombers or the plotters who targeted a contest to draw cartoons of the prophet Muhammad.

The same was true with Amri.

Several months ago, during a surveillance operation monitoring radical Islamic preachers, German authorities intercepted a communication, which, in retrospect, appeared to forecast Amri’s violent intent. They would not disclose the precise wording, but two German officials with knowledge of the investigation said the intercept was not straightforward enough to directly indicate an imminent threat.

“He never made such a clear statement during this interaction, which could have led to the conclusion that he would become a martyr,” one of the officials said.

Amri fell into a dangerous gray zone — he was on the U.S. no-fly list a month ago, and Germans had linked him to a radical network led by Abu ­Walaa, a 32-year-old of Iraqi descent arrested in November on charges of recruiting and sending fighters from Germany to the Islamic State.

Amri had also been under police surveillance for several months until September of this year, because he was suspected of planning a burglary in Berlin to finance the purchase of weapons. The suspicion wasn’t confirmed, however, and authorities found him guilty only of being a small-time drug dealer.

“This kind of super-low-tech, improvised thing is hard,” said Rafael Bossong, research associate at the German Institute for International and Security Affairs. “The guy didn’t buy any weapons. He didn’t give off absolutely clear signals. The question is, how do you definitely prevent that?”

Amri appears to have attempted to manipulate the German asylum system — an inundated bureaucracy clogged with a backlog of more than 400,000 cases following the arrival of 1.2 million asylum seekers over the course of the past two years.

According to Der Spiegel, he claimed to be Egyptian and to have suffered persecution there when applying for asylum in Germany in April. When officials questioned him, he could not answer basic questions about his alleged home country. They checked their data system and found that he had been registered under several aliases and birthdays. By July, his asylum request was rejected.

And yet, they could not deport him, because Tunisia initially refused to take him — issuing him a passport only last Monday, the same day as the attack.

The way the system is designed, even had Amri fully cooperated, however, the Germans would not have had access to his criminal record in Italy. The computer databases used in Europe to vet migrants in the first instance does not include such data.

European law enforcement officials say that sharing information across borders has sharply increased in the 13 months since the Bataclan attack in Paris. But just because information is in a database does not always mean that it gets used, they say.

“I’m not sure it’s that we don’t have enough information,” said Brian Donald, the chief of staff of Europol, the pan-European police agency. “I think it’s more about ensuring that law enforcement has access to the information we have.”

Back in Oueslatia, Amri’s family remains incredulous. His brothers and sisters rushed back to their mother’s home, a simple house on a dirt street, when they heard the news.

They said he changed after his arrest in Italy.

“He started praying during his time in jail in Italy,” his sister said. “He even asked me to send him a book called, ‘Paradise for good people.’ ”

After his release, he told them he survived off small jobs — painting, running errands.

The siblings huddled around a little charcoal burner, the sisters all hunched, arms wrapped tightly around them. They said they find it hard to believe that it was him, but if it’s true, that he brought shame on his family and Tunisia.

They have been trying to contact him ever since they heard about him being wanted. His phone has been switched off.

They say he left for Italy in spring 2011, following a crime they say he was framed for. The arson in Italy, they insist, was also an accident.

His mother, Nour el Huda, 60, who at times had to leave the room to compose herself, described her youngest son as someone who used to drink alcohol and enjoyed Tunisian folk music. In jail in Sicily, according to the Italians, he spent time with a violent group of Tunisians and religious radicals.

But there was so much he didn’t tell them — including his attempt to claim asylum in Germany. After his release from the Italian jail, he got by, they said, by doing odd jobs. House painting. Running errands.

“My son was planning to come back next year and start a small business here, said his mother, Nour el Huda, 60, her voice trembling. “He was homesick.”

“We hope he didn’t do it; we really hope he wasn’t involved,” she repeated as a German camera crew pulled up outside.

Kottoor reported from Oueslatia, Tunisia; Pitrelli, from Rome. Souad Mekhennet and Stephanie Kirchner in Berlin, Michael Birnbaum in Brussels and Greg Miller in Washington contributed to this report.