BERLIN—The 24-year-old Tunisian migrant suspected of killing 12 people in an attack in Berlin this week typified a new wave of young jihadists in Europe who mix drug dealing and other illegal activities with Islamist terror.

Anis Amri, who was killed in a shootout with Italian police in Milan on Friday after days on the run, peddled cocaine in a hip neighborhood of the German capital, while becoming increasingly radicalized and declaring his allegiance to Islamic State.

It is a pattern that has become increasingly common. Two brothers involved in the November 2015 attacks in Paris sold hashish from a bar in the Belgian capital, Brussels. One—Salah Abdeslam, the main surviving suspect in that assault—served time in prison for breaking into a garage. The other had repeated brushes with the law for theft, drugs and weapons possession.

“You have a crossover between criminals and extremists,” said Magnus Ranstorp, a counterterrorism expert at the Swedish Defence University. “They are just as at ease with selling drugs, petty crime and dabbling in extremism.”

Part of the problem is a relatively lax attitude toward regular criminals who in Europe often serve reduced sentences as authorities seek to unclog overcrowded prisons that can become breeding grounds for future jihadists.