(CNN) Thirteen suspects have been arrested in connection with the beheading deaths of two tourists in Morocco, the state-controlled 2M news agency reported.

Four are suspected of killing 28-year-old Maren Ueland of Norway and 24-year-old Louisa Jespersen of Denmark. Of those four, one had previously served a two-year sentence in an extremism-related case, Boubker Sabik, a Moroccan national security spokesman, told 2M.

Nine others were arrested in different cities for their alleged connection to the four murder suspects, 2M reported.

During the raids, authorities found "suspicious substances that could potentially be used in making explosives," 2M said.

The bodies of Ueland and Jespersen were found Monday in the High Atlas mountain range.

Both women had been spotted with three men in their hotel in Marrakesh before heading to the Atlas Mountains to hike. They were found in Imlil, an unguarded and remote area on the mountain range.

The state-run Maghreb Arab Press reported that the pair had been killed with a "melee weapon."

A video purporting to show the decapitations is being analyzed by the Danish Security and Intelligence Service, the agency told CNN. The video's authenticity has not been verified.

Moroccan authorities say these three men, seen here in images provided by state media outlet 2M, were with the women before they were killed.

The Moroccan government has called the killings a "terrorist and criminal act," and Danish Prime Minister Lars Lokke Rasmussen said the killings seemed to be "politically motivated and thus a terrorist act."

The four suspects accused of direct involvement in the women's deaths appear in a video pledging allegiance to ISIS, but they do not reference the killings.

CNN cannot independently verify the video, which was circulated on social media, but Moroccan authorities say the video is authentic.

ISIS has a presence in Morocco, Sabik told 2M.

"The four top suspects made no contacts with other ISIS abroad, and none of them were in Iraq or Syria," he said.

"On December 14, the suspects moved to that area to search for potential targets, claimed they were on a picnic, and filmed a 'pledge' tape inside a tent in that area, without any contact with (ISIS) outsiders," Sabik said.

Moroccans gathered outside the Danish Embassy in Rabat on Saturday.

On Saturday, Moroccans gathered to mourn the tourists' deaths outside the Norwegian and Danish embassies in Rabat, the capital. Hundreds of people held vigils, with some holding signs saying "Pardon" or "Sorry" in English.

Denmark's ambassador to Morocco, Nikolaj Harris, thanked the demonstrators Saturday "with all my heart for your messages of compassion ... after the murder of Louisa. I am very touched."

Merethe Nergaard, Norway's ambassador to Morocco, advised against "giving in to fear" and said that Norway and Morocco remain allies in the battle against extremists.

"We have full confidence in the ability of the Moroccan authorities to complete the investigation and we greatly appreciate the assistance," she said.