DUBAI (Reuters) - The United Arab Emirates has outlawed religious or racial discrimination, the state news agency WAM said on Monday, citing a royal decree by President Sheikh Khalifa bin Zayed Al Nahyan.

The law is aimed in part at countering Islamist militancy, particularly the practice known as takfir, whereby hardline Muslims label followers of other schools of Islam unbelievers, but it also outlaws insults against religions.

"The new law No. 02 of 2015 criminalizes any acts that stoke religious hatred and/or which insult religion through any form of expression, be it speech or the written word, books, pamphlets or via online media," WAM reported.

The UAE, an oil-exporting confederation of seven Muslim emirates ruled by hereditary dynasties and bordering Saudi Arabia and Oman, is worried about political Islam, which appeals to religious conservatives while challenging its lack of democratic rule.

It has declared the Muslim Brotherhood a terrorist organization -- the Brotherhood denies any involvement in militant violence -- and taken part in U.S.-led air strikes on the ultra-radical Islamic State insurgent group in Syria.

The UAE is also concerned about efforts by Sunni Muslim jihadists to stoke sectarian tensions in the Gulf with recent blasts at Shi'ite Muslim mosques in Saudi Arabia and Kuwait.

Militant violence is rare in the UAE, but Islamic State has urged Muslims in Gulf countries to target Western expatriates in retaliation for attacks against it.

While all UAE citizens are Muslims, most of them are Sunni. The country is also home to hundreds of thousands of non-Muslim expatriates and is a popular destination for foreign tourists.

Human rights organizations criticize the country for clamping down on free speech and accuse it of using laws against terrorism to jail peaceful critics of the government.