A man lights a candle at a memorial for the victims of the deadly attacks in front of the synagogue in Krystalgade in Copenhagen, Feb. 15, 2015. Reuters/Leonhard Foeger

Nearly 10 years after Denmark’s Jyllands-Posten newspaper published inflammatory cartoons depicting the Prophet Muhammad, including one with a bomb in his turban, the country is reeling from twin terror attacks, at a café and a synagogue, that killed two civilians and injured five police officers. The Saturday attacks, purportedly carried out by a man “inspired by militant Islamist propaganda,” shed light on the Scandinavian country that has sent the second-highest number of foreign fighters to join the Islamic State group in parts of Syria and Iraq.

Denmark’s Jihadi Fighters

“The Muhammad cartoons [published in the daily Jyllands-Posten in 2005] have played into the increasing polarization of the Danish society, and there has also been discrimination against immigrants,” Magnus Ranstorp, a leading terrorism expert at Sweden’s Defense College, told Newsweek in an October interview. “In addition, there are radical imams, and the Islamist group Hizb-ut-Tahrir is pretty big. Young people join it or more radical offshoots and it’s suspected that these offshoots may be playing a role in facilitating trips for them to Syria.”

Due to the estimated 100 Danes in combat in Syria and Iraq, the Danish government established a rehabilitation program in September for former fighters. Rather than punitive measures, a national hotline, mentors and an “exit” center were created to reform former and potential jihadis.

“We cannot afford not to include them back in our society and make sure that their path of radicalization is changed, so they can be an active part of our society,” Jacob Bundsgard, the Social Democrat mayor of Aarhus, told the New York Times in September after the program’s launch. The country’s second-largest city has seen at least 30 Muslim residents travel to Syria since 2012.

“What motivates these young people is not that far from the motivation the rest of us have: a decent life,” Preben Bertelsen, a professor of psychology at the University or Aarhus, told Newsweek. “For them, joining ISIS is fighting for utopia, fighting for a place where they’re wanted. In that sense they’re not that different from other young people.”

Domestic Threats

While some Danes are choosing to fight abroad, the country has faced numerous domestic threats, not including the deadly shootings carried out Saturday. In September 2005, the country’s Jyllands-Posten newspaper printed 12 cartoons of the Prophet Muhammad. Protests were held in major cities worldwide, Danish embassies in Damascus, Beirut and Teheran were set on fire.

Kurt Westergaard, 79, the cartoonist who created one of the cartoons that depicted Muhammad with a bomb in his turban, has lived under police protection for the past decade. In 2010 he survived an assassination attempt after a man wielding an ax forced his way into Westergaard's home. He escaped to a panic room and notified police.

That same year, Danish police thwarted a terror plot against the Jyllands-Posten. Four suspects described as militant Islamists were arrested in several raids that also uncovered an armory of automatic weapons, ammunition and wrist ties.

“We could hear them planning the attack,” lead prosecutor Gyrithe Ulrich told the New York Times, describing the four months of surveillance the police conducted on the suspects. They were later convicted and sentenced to 12 years in prison.

After Charlie Hebdo

More recently, the attack at the Charlie Hebdo offices in Paris last month prompted Jyllands-Posten and other Danish newspapers to increase security in their buildings.

"Charlie Hebdo didn't shut up ... and they have now paid the highest price for that," Flemming Rose, the former culture editor of Jyllands-Posten who commissioned the Muhammad cartoons in 2005, said in a January interview. "It sends a shiver down my spine.”

Since the attacks, critics have blamed France’s secularist society for the rise in alienation, citing right-wing measures that limit both Jewish and Muslim worship in the country. Denmark has adopted similar measures within its borders.

In February 2014, the Danish government banned the religious slaughter of animals -- a practice used among Jews and Muslims for kosher and halal meat. Last June, Copenhagen’s first mosque opened amid controversy it would preach a conservative form of Islam that could lead to radicalization.

On Monday night, the country’s PEGIDA chapter (Patriotic Europeans against the Islamization of Europe) is planning to host a rally in Copenhagen. Nearly a month ago, the group hosted a rally of several hundred people days after the Charlie Hebdo attacks that killed 12 people in Paris on Jan. 7.