Five suspected Islamist militants have been arrested for planning a gun attack at the Copenhagen offices of a Danish newspaper that printed cartoons of the Prophet Muhammad in 2005, police say.
The men intended to burst into the Jyllands-Posten office and kill as many people as possible, officials said.
Denmark's justice minister said the attack would have been "outrageous".
Police later evacuated a building where one of the men was held after finding what were thought to be explosives.
Four of the suspects were held in Denmark and the fifth was detained in Sweden.
Denmark's security agency Pet said the suspects included two Swedish residents with Tunisian backgrounds, one Lebanon-born Swede, and an Iraqi. The other was described only as Swedish.
Earlier this month, an Iraq-born Swedish Muslim blew himself up in Stockholm - apparently as he was preparing a suicide bombing.
Swedish police say the suspects held on Wednesday are not thought to be linked to the Stockholm bomber.
The publication of the cartoons in 2005, one of which depicted the Prophet Muhammad with a bomb-shaped turban, caused mass protests among Muslims across the world.
Muslims regard any visual representation of the Prophet as blasphemous.
Cartoons used 'efficiently'
The four held in Denmark were picked up in raids on flats in the Greve and Herlev suburbs of Copenhagen.
Police searches uncovered an automatic weapon, a silencer and live ammunition.
A property in Greve, where one of the suspects, an Iraqi asylum seeker, was arrested, was evacuated at about 2100 local time (2000 GMT) after police discovered a suspicious item they thought could be explosives.
One resident of the building told the Politken newspaper a police officer had ordered her to evacuate immediately.
"He also said we should bring plenty of warm clothes, because this was going to take a long time," she added.
The newspaper said the area had been sealed off up to 100m away and that a bomb-clearing robot had been sent in.
Jakob Scharf, head of Pet, said the men had been planning to enter the building housing the Jyllands-Posten and "kill as many of the people present as possible".
He said an "imminent terror attack" had been foiled, and that the suspects belonged to a "militant Islamist group and they have links to international terrorist networks".
"Obviously the cartoons have been used very efficiently by militant Islamist groups worldwide in targeting Denmark specifically and trying explain why the violent extremism is necessary," he said.
Sweden's security chief Anders Danielsson said they had known for months that the group was planning an attack, but the authorities had to wait until they had enough evidence for a prosecution.
Justice Minister Lars Barfoed said the "outrageous" plot was "the most serious attempt at terror so far in Denmark".
Cartoonist under guard
As a result of the row over the cartoons, Saudi Arabia recalled its Copenhagen ambassador, Danish firms were forced to scale back operations in some parts of the world, and gunmen raided an EU office in Gaza to demand an apology.
But many in the West have defended the media's right to publish the caricatures, and several European newspapers have republished some of the drawings.
Kurt Westergaard, the cartoonist who drew the image of the turban bomb, has been honoured with awards by free-speech groups, but he now lives under police guard amid death threats from radical groups.
He was the subject of an attempted attack in January when a Somali man got into his home armed with a knife and an axe.
And police across Scandinavia have arrested several groups of people in raids linked to the cartoons.
Three men detained in Norway in July were suspected of planning attacks to avenge the cartoons.
In September, a Chechnya-born Belgian was arrested after a small explosion in Copenhagen, which police linked to the cartoons.
- 2 January 2010
- 8 July 2010
- 13 December 2010
- 17 September 2010
- 2 January 2010