LONDON - Scandinavian authorities thwarted what they described as a terrorist attack in Denmark targeting the newspaper that published the infamous caricatures of the prophet Muhammad, arresting five suspected Islamic extremists Wednesday.

According to a statement published by the Danish spy agency PET, the suspects' target was the Copenhagen offices of Jyllands-Posten, which in 2005 published cartoons lampooning Muhammad, who founded the Islamic religion in the seventh century. The cartoons prompted an international uproar.

Jakob Scharf, head of PET, described the suspects as "militant Islamists" with "connections to international terror networks" who had sought to penetrate Jyllands-Posten's offices and "kill as many as possible."

At a joint news conference held in Copenhagen by Danish and Swedish intelligence, Scharf said the planned attack had been imminent.

"The attack would be carried out before Jan. 1, and one would have then entered the newspaper and, using the machine gun, [killed] as many as possible," he said.

The alleged plot underscores what security officials see as a rising threat by Islamic extremists against Scandinavian countries that once considered themselves unlikely targets.

Denmark, Sweden, and Norway, all with histories of relatively liberal immigration and asylum policies, contribute troops to the U.S.-dominated force backing the government of Afghanistan. Islamic extremists see the mission as a foreign occupation of Muslim land.

Both Sweden and Denmark have drawn the ire of Islamic extremists after cartoonists published what many Muslims considered demeaning caricatures of Muhammad.

"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," Scharf said.

Kevin McGwin, managing editor of another Danish newspaper, the Copenhagen Post, told Al-Jazeera that the latest incident was the seventh attack or threat since 2008 against the Jyllands-Posten building or someone connected to the newspaper.

"They have upped security both at their Copenhagen offices as well as ... in another part of the country very seriously," he said.

Four of the five suspects arrested were found in apartments in Greve, 12 miles from Copenhagen, and in the suburb of Herlev, according to PET's statement. A fifth suspect was arrested in Stockholm, the Swedish capital.

Danish security authorities said they seized plastic strips that could be used as handcuffs, a gun with a silencer, and live ammunition.

Scharf said the arrests resulted from a long investigation by Danish and Swedish police and intelligence forces.

Petter Liljeblad, spokesman for the Swedish security service, SAPO, said that four of those arrested lived in Sweden and one in Denmark, and that three were Swedish nationals and one a Tunisian national.

The suspects had been under close scrutiny by SAPO, Swedish intelligence chief Anders Danielsson said at the news conference.