KUALA LUMPUR (Reuters) - Malaysia’s royal rulers have agreed to the government’s plan to appoint a non-Muslim attorney-general, the palace said, after a near two-week impasse that stoked racial tensions in the Muslim-majority Southeast Asian country.

Groups representing the ethnic Malay majority rejected the plan to appoint top lawyer Tommy Thomas in what amounted to probably the first resistance faced by new Prime Minister Mahathir Mohamad since he won a stunning election victory last month on promises to fight corruption and reform institutions.

Malaysia’s palace said King Muhammad V had decided to end the tenure of Attorney-General Mohamed Apandi Ali and appoint Thomas as his replacement on Mahathir’s advice and after consulting with the heads of the other eight royal households.

“The appointment will preserve the special rights of the Malays and Bumiputera and the status of Islam as the religion of the federation,” palace official Wan Ahmad Dahlan Abdul Aziz said in a statement on behalf of the king late on Monday.

Bumiputera means “sons of the soil”.

Thomas is the first non-Malay to take the post of attorney-general since Malaysia was formed in 1963.

Malaysia’s council of rulers, which is formed by the heads of the country’s nine sultanates, was initially scheduled to meet on Tuesday to discuss the government’s plan to appoint Thomas.

Its decision is likely to quell dissent in the Muslim Malay community, which makes up about 60 percent of Malaysia’s population of roughly 32 million.

An ethnic Indian Christian, Thomas’ key task will be to prosecute those involved in graft at heavily indebted state fund 1Malaysia Development Berhad (1MDB). The 1MDB scandal was one of the main reasons behind the downfall of former prime minister Najib Razak.

Mahathir proposed Thomas for the job nearly two weeks ago, domestic media have reported, after ordering Mohamed Apandi to go on leave.

Mohamed Apandi cleared Najib of any wrongdoing in the multi-billion dollar 1MDB scandal.

Najib denies any wrongdoing but has been barred from leaving the country since his election defeat and enforcement agencies have relaunched a probe into how 1MDB funds went missing.