Something happened in prison to Omar El-Hussein, the 22-year-old identified by police as the gunman who killed two people in a weekend shooting spree in Copenhagen.
His transformation from small-time criminal to cold-blooded killer is fueling a debate about whether a radicalized environment in Danish prisons is pushing smalltime gangsters into the arms of Islamic extremism.
"He was crazy. When he came out of prison he was totally nuts," a taxi driver from the housing estate where El-Hussein lived and played as a child told AFP.
Copenhagen's longstanding problem with criminal gangs means the authorities are now concerned that El-Hussein's journey from joining a gang in the immigrant community where he grew up, via prison into extremism could mirror a wider trend.
Having been sentenced to two years in prison for a stabbing, he displayed a newfound interest in religion after being released just a fortnight before the attacks that targeted a synagogue and a cultural center hosting a debate on free speech and Islam.
"The things he talked about completely flew over the boys' heads," a source who knew him since his childhood days on the inner city Mjoelnerparken estate told the Berlingske newspaper.
Emerging from jail, he was no longer talking about "cars and girls", the paper quoted sources as saying, but about "ending up in paradise".
El-Hussein served his time in the same facility as Sam Mansour, a Muslim radical convicted several times for inciting terrorism.
Prison services flagged El-Hussein up as being at risk of radicalization, but the Danish intelligence agency said it had "no reason" to believe he was planning attacks.
The head of a prison workers' union, Kim Oesterbye, told AFP that radicalization was "widespread" among inmates and that it wasn't unusual to hear them cheer the deadly attacks on French satirical weekly Charlie Hebdo and a kosher supermarket last month.
Danish inmates could be heard shouting about Jyllands-Posten, Oesterbye said, referring to the Danish newspaper that triggered violent protests in the Muslim world with its 2005 publication of caricatures lampooning the Muslim prophet Mohammed.
"It could be about someone wanting to do something to this or that Mohammed critic. It's outbursts of rage, it's cries of anger," he said.
The leader of another prison workers' union, John Hatting, called for inmates with Islamist views to be separated from "vulnerable" youths from immigrant backgrounds.
"We'll have to move them away from where they can influence others... so that they are only around (non-Muslim) Danes," he told AFP.
Many in prison were looking for direction and meaning in their lives, making them easy prey for extremists, he said.
A former inmate told public broadcaster DR that Muslim extremists had tried to turn him against ethnic Danes and Jews.
"It's brainwashing. They try to get close and become friends with you," said the young man, who asked to remain anonymous.
Danish Justice Minister Mette Frederiksen has said she is open to the idea of separating "influential" extremists from inmates at risk of becoming radicalized.
"I pay a lot of attention when staff who walk around inside the prisons say it could be part of the solution. They have their fingers on the pulse," she told DR.
Two of the Paris gunmen, Amedy Coulibaly and Cherif Kouachi, are believed to have turned to radical Islam in the prison where they met.
Mohamed Merah, the Al-Qaeda terrorist who shot dead seven people in a series of 2012 attacks in France, and Mehdi Nemmouche, last year's Brussels Jewish museum killer, are also believed to have been radicalized in jail.
The number of inmates displaying radicalized behavior in Danish jails has spiked in recent years because of efforts to combat gang-related crime, usually in neighborhoods with a large number of immigrants, Oesterbye said.
Before he was put behind bars, El-Hussein had been linked to the Brothas gang from the low-income estate where he grew up.
"These youths are flying in and out of jail," Oesterbye said.
Controversial stop-and-search zones have been used to target the problem, but as recently as 2013 gun and knife violence flared up again.
Denmark's Centre for Terror Analysis said last year that "several people from the criminal environment, including gangs, are joining the Islamist environment, which sympathizes with militant Islam."
Per capita, Denmark is the second largest European source after Belgium of jihadist fighters going to the Middle East.
However, Louise Aagaard Larsen, who helps train staff at the Danish Prison and Probation Service, said prisons were only a small part of the problem.
Of El-Hussein, she said the trauma of being in prison could have "pushed him over the edge", but that jail time alone was not enough to turn criminals into terrorists.
"There may be individual gang members who are religious but I don't think there are any gangs where religion is the goal," she said.
"I'm more concerned about becoming the target of gang-related crime in one way or another in prisons because that we have seen to a high degree."
She said there had been cases of Danish youths traveling to Syria and joining a criminal gang after returning.
"The question about these young men is whether it's about Islam or the hash market or something as basic as a having a sense of belonging somewhere."