Anis Amri, the Tunisian suspect in the Berlin truck attack who was shot dead in Milan on Friday, followed the well-trodden path of petty criminal turned jihadist killer.
Security sources believe the rejected asylum seeker was radicalised during a four-year stint in an Italian prison before he murdered 12 people in Monday's attack on a Christmas market in the German capital.
Amri, who turned 24 years old while on the run Thursday, was hailed as a "soldier of the Islamic State" by the IS-linked Amaq news agency after the bloody assault.
When he pulled his gun on the Italian police early Friday before they shot him dead, Amri reportedly yelled "Allahu Akbar" (God is greatest).
In a growing security scandal in Germany, Amri had long been watched as a potentially dangerous jihadist but managed to avoid both arrest and deportation.
Amri's journey began in Oueslatia, a poor desert town in central Tunisia. The youngest of nine siblings, he was known to police as a juvenile delinquent who drank and took drugs.
He was 18 when the Tunisian revolution erupted in early 2011 and overthrew long-time dictator Zine el-Abidine Ben Ali.
Amri took advantage of the turmoil to flee the country, escaping a four-year jail term handed down in absentia for robbery and burglary.
He also "left to get away from misery", his brother Abdelkader told AFP this week.
"He had no future in Tunisia and wanted at all costs to improve the family's financial situation. We live below the poverty line, like most families in Oueslatia."
Like thousands of other migrants, Amri made the dangerous Mediterranean crossing and landed in March on the small Italian island of Lampedusa, where he lied about his age and was taken as an unaccompanied minor to Sicily.
Soon after, Amri was arrested on arson charges for burning a school building which had been converted into a refugee shelter. He was sentenced to four years in prison.
Not a model prisoner, he received no early release. It was behind bars that he was radicalised as an Islamic extremist, a classic phenomenon in Europe, local media reported.
Upon his release, Italy ordered him to leave the country, while Tunisia refused to take him back.
In July 2015 he headed to Germany, as tens of thousands of Middle Eastern and African migrants flocked to Europe's biggest economy.
His brother said Amri "worked as an agricultural labourer and things like that".
"He'd contact us on Facebook, saying he wanted to come back to Tunisia but that he had to earn some money to buy his own car and start his own business."
German security agencies say he quickly mingled in radical Islamist circles but evaded authorities by changing location frequently and using up to six different identities.
Amri repeatedly contacted Islamist "hate preachers" including the Iraqi Ahmad Abdulaziz Abdullah A. alias Abu Walaa, who has since been arrested accused of seeking to recruit fighters for IS.
News weekly Der Spiegel reported that in wiretaps, Amri could be heard offering to carry out a suicide operation, but that his words were too vague for an arrest warrant.
Counter-terror agencies were surveilling Amri and suspected he was preparing "a serious act of violence against the state," said Ralf Jaeger, interior minister of North Rhine-Westphalia state.
Berlin prosecutors, who were in charge of the case, said Amri had been suspected of planning a burglary meant to raise cash to buy automatic weapons, "possibly to carry out an attack".
Surveillance had then however shown that Amri was working as a small-time drug dealer in Berlin and once had a bar fight with another dealer. The surveillance ceased in September.
Germany had meanwhile rejected his asylum request in June but was unable to deport him as Amri claimed to have no travel documents.
His deportation then got caught up in red tape with Tunisia, which long denied he was a citizen. The documents only arrived on Wednesday, two days after the Berlin attack, said Jaeger.
Amri's asylum-office papers for a stay of deportation were found in the cab of the 40-tonne lorry that cut a swathe of death and destruction through the festive crowd.
His shocked sister Najoua later told AFP that "he never made us feel there was anything wrong. We were in touch through Facebook and he was always smiling and cheerful."