(CNN) -- Four men have been arrested on suspicion of preparing a terror attack against a Danish newspaper, a spokesman for the Danish intelligence agency PET said Wednesday.
Searches carried out after Wednesday's arrests uncovered a machine gun with a matching silencer and live ammunition, and plastic strips that can be used as handcuffs, the intelligence agency said.
An attack could have been carried out in the coming days, it said.
The arrests were made at two apartments on the outskirts of the Danish capital, Copenhagen, the agency said.
Three of the men live in Sweden and entered Denmark in the past two days, PET said. They are a 44-year-old Tunisian national, a 29-year-old Swedish national born in Lebanon,and a 30-year-old Swedish national whose country of origin was not yet known.
The fourth man is a 26-year-old Iraqi asylum seeker living in Denmark, the intelligence agency said.
At the same time, Swedish authorities arrested a 37-year-old Swedish national of Tunisian origin, the agency said.
Agency Director-General Jakob Scharf said authorities succeeded in repelling an "imminent" terrorist attack.
The targeted newspaper may have been Jyllands-Posten, according to the agency. That is the same paper that published controversial political cartoons of the Prophet Mohammed five years ago.
At a news conference Wednesday, Scharf said the joint investigation between Swedish and Danish authorities had been going on for quite a while.
"We have been following them very closely until the arrests made today," he said. "We believe that the situation has been under control, but we also found it was necessary to intervene now in order to prevent a specific attack in Copenhagen."
Denmark, because it was the country where the controversial cartoons were published, has seen specific terrorist threats.
"Obviously, the cartoons have been used very efficiently by militant extremist groups worldwide in targeting Denmark specifically and trying to explain why the violent extremism is necessary. So Denmark has become a target for these militant extremist groups around the world," Scharf said.
Earlier, Scharf explained the details known about the plot.
"Allegedly, several of the suspects, who must be considered militant Islamists with relations to international terror networks, would have attempted to force their way into the office of Jyllands-Posten or Politiken in Copenhagen and to kill as many as possible of the persons present," Scharf said. "The arrests underline the seriousness of the terror threat directed against Denmark and particularly against institutions and individuals related to the cartoon case."
The arrests have prevented the planned attack, he added, so the case will not lead Denmark to reassess its terrorism threat level.
The suspects are expected to be remanded into custody Thursday while police continue their investigation. Further arrests are possible, the agency said.
Some Muslims believe the Quran forbids showing an image of the prophet, and the cartoons provoked further ire because they depicted the prophet wearing a bomb as a turban with a lit fuse.
Other newspapers around the world reprinted the cartoons the next year, prompting international demonstrations, some of them violent.
CNN's David Wilkinson contributed to this report.