The shooting spree in Copenhagen by a radicalized former gang member has highlighted an overlap between Islamic extremists and the criminal underworld.

Danish police say gang members with Muslim backgrounds are being radicalized both in prison and outside, and some have joined the ranks of foreign fighters in Syria.

"We know that some of the fundamentalist groups are fishing in that pond," said Michael Ask, head of Denmark's National Center of Investigation. "Because they know that they have some young people who are vulnerable and rootless, who lack a sense of belonging, a community."

Born in Denmark to Palestinian parents, Omar Abdel Hamid El-Hussein had a long history of violence and crime before he went on a rampage last weekend, killing two people and wounding five in attacks on a free-speech event and a synagogue.

The 22-year-old, who was killed in a shootout with police, had been member of "Brothas," an inner-city immigrant gang in Copenhagen, but was reportedly kicked out because of his temper.

"He got into fights with members of other gangs. So when they wanted to make peace agreements with other gangs, they threw him out," said Aydin Soei, a social worker who's been researching Denmark's gang scene and who met El-Hussein in 2011.

Where and when El-Hussein was radicalized remains unclear. Prison authorities alerted the Danish domestic intelligence service, PET, last year while he was serving time for a stabbing, but the latter said there was no reason to believe he was plotting an attack.

Already before the shootings, Danish authorities were concerned about gang members crossing over to Islamic extremism.

In July last year, police informed lawmakers that among the scores of people who have left Denmark to become foreign fighters in Syria were at least five known gang members, and several others with a "peripheral relation" to street gangs.

"Some of them use it as an exit strategy," said Magnus Ranstorp, a terrorism expert at the Swedish National Defense College. "They leave criminal gangs for a new belonging, a new identity."

Others are tempted by violence more than religion or ideology, said Ask, of the National Center of Investigation.

"It is some kind of test of manhood. You get credit in the criminal world when you can say that you have been in some kind of war zone," he said.

Ahmed Samsam, a member of a gang in the city of Odense, traveled to Syria in 2012 and posted pictures on social media of himself posing with automatic weapons. Abderrozak Benarabe, a Copenhagen gang leader, went to Syria with a Danish documentary crew in tow. He joined Ahrar al-Sham, an ultraconservative Muslim rebel group. Both are back in Denmark and have never been charged for their Syria trips.

The link between organized crime and Islamic extremists is not new in Europe. In the mid-1990s, French police uncovered an extremist network by going after what they thought was a gang carrying out violent robberies in France's northern Roubaix region.

Members of the gang, dismantled in a deadly 1996 shootout, allegedly tried to bomb a police station in Lille ahead of a G-7 summit meeting there.

The link between gang members and international terrorism strengthened after al-Qaida shifted tactics from large-scale attacks by well-trained terrorists to smaller strikes by homegrown militants, said Frank Jensen, former operative chief of PET. For those attacks, gang members seem like the perfect foot soldiers: angry, aggressive young men who know where to find weapons.

Jihadi recruitment networks have long targeted poorly integrated Muslim youth who feel marginalized and discriminated against in the Scandinavian countries and elsewhere in Europe. However, Swedish and Norwegian security officials said they hadn't seen any significant numbers of gang members being recruited for jihad.

"We see everything from people with a background in petty crime to well-established young men who have found a place in society," said Sirpa Franzen, spokeswoman of the Swedish security police, SAPO.

Though young Muslim gang members in Denmark don't live an Islamic lifestyle — their focus is on crime, drug dealing and turf wars with rival gangs — they often harbor a hatred of Danish society that can easily lead to radicalization, said Mohammad Rafiq, a writer and social worker who heads the Copenhagen-based International Institute of Human Rights.

Being Muslim, they say, just adds to their feeling of being outsiders.

"They do not feel they are part of society," said Khaterah Parwani, a law student born in Afghanistan who is part of a network helping immigrants with legal advice. "They did badly in school, they do badly in their daily lives. They find an identity in the gangs."

In the Muslim-dominated neighborhood where El-Hussein was killed by a SWAT team, there were mixed feelings about what he did. While many were appalled by the violence, some mourned him as young man who never got a chance in life.

On Monday, about two dozen young men in hooded jackets, some with masked faces, arrived on the street where El-Hussein died. Identifying themselves to reporters only as his "brothers," they put up a sign saying "rest in peace" and a letter listing grievances against Danish society. After shouting "God is great" in Arabic, they left.

___

Karl Ritter in Stockholm and Elaine Ganley in Paris contributed to this report.