Morocco said on Wednesday that it had arrested 52 suspected militants inspired by Islamic State and that it had foiled several attacks in the North African kingdom by seizing weapons and bomb-making materials.

It is the largest group arrested in years and the latest of a series of cells that the authorities say they have found plotting attacks inside and outside Morocco.

The North African kingdom, an ally of the West against Islamist militancy, has been on high alert since 2014, when IS took control of large swathes of northern Iraq and Syria.

The 52 arrested were among 143 people investigated in many Moroccan cities and towns, the interior ministry said in a statement.

Many members of the group were planning to create an Islamic State province (Wilayat) in Morocco, the statement said. They intended to assassinate Moroccan security and military officers and tourists, as well as targeting prisons and festivals and other institutions in the country.

Morocco's Central Bureau of Judicial Investigation, the judicial part of the Moroccan domestic intelligence service, has tracked suspected militants since Islamic State established itself as a global threat.

Morocco has dismantled 38 suspected militant cells with Islamic State ties since 2013, the statement said, adding 159 cells had been found since 2002.

Hundreds of fighters from Morocco, Tunisia and Algeria have joined Islamist militant forces in Syria. Some are threatening to return and create new jihadist wings in their home countries, security experts have said.

Nearby Libya has become a major draw for jihadists from North Africa and sub-Saharan Africa. Islamic State has taken advantage of the security chaos there to build a base, operate training camps and take over the city of Sirte.

Morocco has been the target of militant attacks, most recently in 2011 in Marrakesh, when an explosion in a cafe killed 15 people, mostly foreigners.