The Moroccan authorities believe four suspects in the killing of two Scandinavian women in the Atlas Mountains were acting on their own initiative, even though they had just pledged allegiance to ISIS, an official said on Sunday.

Boubker Sabik, spokesman for the Moroccan security forces, also said the arrest of nine more people in the case had foiled a terror plot.

Louisa Vesterager Jespersen, 24, from Denmark, and Maren Ueland, 28, from Norway were found dead early on Monday near the village of Imlil on a route to Toubkal, North Africa’s highest peak and a popular hiking and trekking destination.

Mr Sabik said the four suspects, aged between 25 and 33 years, had gone to the Imlil area intent on committing a crime but without selecting their target in advance.

They had pledged allegiance to ISIS in a video made on the Friday before the women's bodies were found, but without agreeing this in advance with any foreign entity.

Mr Sabik described the four as “lone wolves”. “The crime was not co-ordinated with Islamic State [ISIS],” he said. “Lone wolves do not need permission from their leader,” he said, without explaining how the authorities came to this conclusion.

One of the suspects had been arrested in 2013 as part of a crackdown on people who wanted to join extremists abroad, Mr Sabik said, adding that this suspect had radicalised the other three.

However, he dismissed reports that one was a returning foreign fighter from the Middle East. All four, who came from the outskirts of Marrakesh, had only informal jobs and had a low level of education, he added.

Referring to the nine other suspects detained on Friday in various Moroccan cities, he said their arrests “spared Morocco a terrorist plot”.

Electronic devices, unregistered hunting rifles, knives and materials that could be used for bomb making were found in those raids.

Mr Sabik gave no details of this suspected plot but said Morocco was stepping up efforts to counter security threats posed by the return of extremist fighters from Syria and Iraq.

So far 242 out of 1,669 Moroccans who joined ISIS had been arrested, he said. Some fighters were using false passports and trying to hide among refugees heading for Europe as the extremists suffer setbacks in the Middle East.

Compared with other countries in North Africa, Morocco has been largely free from militant attacks. The most recent took place in April 2011, when 17 people were killed in the bombing of a restaurant in Marrakesh. In 2017 and 2018, Morocco dismantled 20 militant cells planning attacks in the country.