ABU DHABI: The United Arab Emirates is to try 41 people for allegedly seeking to overthrow the government to set up a caliphate in the Gulf state, prosecutors said Sunday.

Such mass trials on terrorism charges are rare in the UAE which has largely been spared the Islamic militancy that has hit other Arab states.

The suspects, who include Emiratis as well as foreigners, are accused of setting up a group “with a terrorist, takfiri (Sunni Muslim extremist) ideology,” in a bid to “seize power and establish a caliphate,” the prosecutor general said.

They are accused of setting up cells to train members in handling weapons and the manufacture of explosives in preparation for attacks on UAE soil.

Prosecutors charge that they were “in contact with foreign terrorist organizations... to help them achieve their goals.”

The UAE is part of the US-led coalition that has been carrying out air strikes against the Daesh group (Arabic acronym for Islamic State) in Syria since September last year and has upped security measures since the wave of Arab Spring protests that swept the region four years ago.

In July, following the murder of an American teacher in an Abu Dhabi mall, authorities enacted tougher anti-terror legislation, including harsher jail terms and even introducing the death penalty for crimes linked to religious hatred and “takfiri groups.”

Takfiris regard Muslims who do not follow their extreme interpretation of Islam as apostates punishable by death.

It is the ideology of Al-Qaeda as well as Daesh.

Alaa Bader Al-Hashemi, 30, was executed last month for December’s stabbing murder of Ibolya Ryan, 47.

Hashemi’s execution was the first in the UAE since January 2014 when a Sri Lankan was put to death by firing squad for murdering an Emirati man in 2006.

The prosecutor said Sunday that the cell was highly organized, operating under a “hierarchy” to recruit young Emiratis, obtain weapons and manufacture explosives, and spread extremist propaganda.

It is the second time in recent years that the UAE has carried out a mass trial on terrorism charges.

Like neighboring Saudi Arabia, the UAE regards the Muslim Brotherhood, the party of ousted Egyptian president Muhammad Mursi, as a terrorist organization.

In 2013, it sentenced 60 people to jail terms of between seven and 15 years for links to the Brotherhood in the first trial of its kind in the country.

The Brotherhood is one of dozens of Islamist-inspired groups outlawed in the UAE in a blacklist that extends far beyond the Daesh and Al-Qaeda.

Daesh, which controls large areas of Iraq and Syria, has carried out a series of attacks in the Gulf, including bombings of Shiite mosques in both Saudi Arabia and Kuwait.