• Jyllands-Posten daily's Copenhagen office. Picture: AFP
Denmark's intelligence service said it arrested four men in two raids in suburbs of Copenhagen, and seized an automatic weapon, a silencer and ammunition. Swedish police said they arrested a 37-year-old Swedish citizen of Tunisian origin living in Stockholm.
"An imminent terror attack has been foiled," said Jakob Scharf, head of the Danish Security and Intelligence Service, or PET. He described some the suspects as "militant Islamists with relations to international terror networks" and said that more arrests were possible.
PET said it seized a 44-year-old Tunisian, a 29-year-old Lebanese-born man and a 30-year-old who were living in Sweden and had entered Denmark late on Tuesday. The fourth person detained was a 26-year-old Iraqi asylum-seeker living in Copenhagen.
The Danish intelligence service said the group had been planning to enter the building where the Jyllands-Posten daily has its Copenhagen office and had wanted "to kill as many of the people present as possible." The four men face preliminary charges of attempting to carry out an act of terrorism.
Zubair Butt Hussain, a spokesman for the Muslim Council of Denmark, called the plan "extremely worrying."
The organisation "absolutely condemns any act of terrorism regardless of the motives and motivations that may lie behind," Mr Hussain said.
There have been at least four plots to attack against Jyllands-Posten or Kurt Westergaard, the artist who drew the most contentious of 12 cartoons, which were published by the daily in 2005 as a challenge to perceived self-censorship.
"The foiled plot is a direct attack on democracy and freedom of press," Westergaard said. "We may not and won't let anyone forbid us to criticise radical Islamism."
In January, a Somali man broke into Westergaard's home wielding an axe and a knife but the artist escaped unharmed by locking himself in a safe-room in the house. In 2008, two Tunisians with Danish residence permits were arrested for plotting to kill him.
In September, a man was wounded when a letter bomb he was preparing exploded in a Copenhagen hotel. Police said it was intended for the daily.
The cartoons also provoked massive and violent protests in 2006 in Muslim countries where demonstrators considered the drawings as having profoundly insulted Islam. Islamic law generally opposes any depiction of the prophet, even favourable, for fear it could lead to idolatry.
The attacks and threats have caused concern and unprecedented security measures in Denmark.
The JPPOL media group building, which includes Jyllands-Posten, is protected by metal fences and guards at all entrances. Mail is scanned and newspaper staff need identity cards to enter the buildings and the various floors.
Lars Munch, JPPOL chief executive, said his workers were worried. "It is appalling for our group, for our employees and their families to see their workplace threatened," he said.
Danish justice minister Lars Barfoed described the plot as "terrifying."
"The group's plan to kill as many as possible is very frightening and is probably the most serious terror attempt in Denmark," Mr Barfoed said.