Five Islamic extremists have been caught as they planned to massacre staff at the Danish newspaper that printed cartoons of the Prophet Mohammed.
The men, arrested in a security service operation, intended to shoot as many people as possible at the Jyllands-Posten daily in Copenhagen.
Denmark's intelligence service held four men in two raids in suburbs of the capital and seized an automatic weapon, a silencer and ammunition.
Swedish police said they arrested a 37-year-old Swede of Tunisian origin living in Stockholm.
“An imminent terror attack has been foiled,” said Jakob Scharf, head of the Danish Security and Intelligence Service, known as 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 Tuesday or early Wednesday.
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 newspaper office “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. They will face a custody hearing today.
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,” he said.
There have been at least four plots to attack 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,” Mr Westergaard said.
“We may not and won't let anyone forbid us to criticise radical Islamism.”
In January a Somali man broke into Mr Westergaard's home wielding an axe and a knife but the artist escaped unharmed by locking himself in a safe-room.