Malaysia and Indonesia, important U.S. partners and leaders in Southeast Asia, have been touted over the past two decades as model countries where Islam coexists with civil law. Malaysia’s prime minister, Najib Razak, founded the Global Movement of Moderates in 2010, an organization that seeks to unite countries to combat extremism and proffers Muslim-majority Malaysia as a tolerant nation. Indonesia, home to the world’s largest Muslim population, has been held up as a leading global example of democratization. (I echoed this view in a 2013 CFR book, Pathways to Freedom: Political and Economic Lessons from Democratic Transitions.)

Leaders in Malaysia and Indonesia, presiding over multiethnic and multireligious societies, had largely thwarted the hardest-line religious groups from exercising an assertive influence over political life. Indonesia became a consolidated democracy in the 2000s, after holding multiple free and fair elections and peacefully transferring power via the ballot box. In Malaysia, the ruling coalition, dominated by Najib’s United Malays National Organisation party, has controlled politics since independence in 1957. While the country’s laws do give special benefits to ethnic Malays, its constitution protects religious freedom.

But since the beginning of this decade, conservative and often Islamist groups, which slowly amassed power in the late 2000s, have gained greater influence in the two countries over the law and politics. They have done so by organizing within democratic politics in Indonesia, and to some extent Malaysia, through grassroots campaigns and local electoral victories. Still, their goals—such as implementing laws based on sharia and rolling back protections for religious minorities—are often at odds with secularism and democracy. Now, in the run-up to Malaysia’s 2018 national elections and Indonesia’s 2019 presidential election, these groups could play central roles in determining the countries’ paths and could possibly undermine hard-won political and legal gains, making the two states less reliable U.S. security and economic partners.

Conservatives Gain Traction

Indonesia and Malaysia have long had strongholds of conservative, even Islamist ideologies. The northeast of the Malay Peninsula has been a bastion of the conservative Pan-Malaysian Islamic Party (PAS), part of the opposition alliance in the last national elections in 2013. In Indonesia, conservative and hard-line religious parties have contested many elections, and debates about the role of Islam in the state have existed since the country was founded. Meanwhile, hard-line, sometimes violent groups like the Islamic Defenders Front have been active for twenty years, participating in vigilante violence in many parts of the country against people and groups they accused of doing immoral activities.

If the rise of hard-liners endangers political stability, it could threaten strategic ties with the United States.

Still, the hardest-line parties and organizations have never attained national power. Moderate leaders, such as former Indonesian President Abdurrahman Wahid, a liberal cleric turned politician, advocated for minority rights and secular law in the early 2000s. Similarly, the ruling coalition in Malaysia remained so strong—the result of its genuine appeal and simultaneous repression of opposition—that for years it did not have to win over more conservative, PAS voters.

More recently, the two countries have witnessed an upswing in harder-line Islamist sentiment. PAS’s leaders have moved, with Najib’s acceptance, to introduce legislation that would increase the power of some religious courts, and possibly impose sharia-type punishments for some criminal offenses such as theft.

Within Indonesia, hard-line groups have pushed national government ministers to take repressive stances toward homosexuality, religious minorities, and people who supposedly blaspheme Islam. Defense Minister Ryamizard Ryacudu called Indonesia’s LGBT activists more dangerous than “a nuclear war,” and in the past two years the police have stepped up attacks on people for homosexual activities. As Human Rights Watch’s Andreas Harsono has noted, the number of annual blasphemy cases has increased during the current presidency of Joko Widodo, also known as Jokowi.

Hard-line Islamist groups—organizing on social media, advocating via sympathizers in government bureaucracies, and building networks in religious schools—have increasingly swayed elections in Indonesia, notably the Jakarta gubernatorial race last year. For the first time, the Islamic Defenders Front and other Islamists played a major role in deciding an outcome in the capital. In that contest, incumbent Basuki Tjahaja Purnama, known as Ahok, enjoyed high popularity ratings. But in late 2016 and early 2017, the Islamic Defenders Front and conservative organizations held massive rallies against Ahok, which sometimes focused on his Chinese ethnicity and his Christian faith. The Islamic Defenders Front and other hard-liners built an alliance with Ahok’s Muslim opponent, Anies Baswedan, who won in a run-off election. Ahok was later convicted of blasphemy for comments he made on the campaign trail and sentenced to two years in jail.

Cultivating a Hard-Line Base

Hard-liners are gaining influence for several reasons. For one, top leaders have proven willing to court Islamists, or they did not take seriously enough the threat of hard-line ideology to secularism and to democracy. In Malaysia, the ruling coalition narrowly won the 2013 national elections, despite losing the national popular vote. Since then, Najib’s administration has been further battered by a scandal surrounding 1Malaysia Development Berhad (1MDB), a state-owned investment firm. Najib has aggressively courted conservative voters who historically supported PAS. If he wins over a sizable number of these voters, he could make up for the ruling coalition’s poor support among many urban ethnic Malays, Chinese, and Indians. In the last election, the ruling coalition won only 25 of the 97 urban and suburban seats. Najib’s recent speeches have touted the idea that Malaysia should be dominated by Muslim ethnic Malays. (Malays and other indigenous groups comprise about 69 percent of the population.)

Meanwhile, in Indonesia, former President Susilo Bambang Yudhoyono and Jokowi ignored the growing power of Islamist groups, which have increasingly raised funds from Saudi Arabia. Yudhoyono took little action as vigilantes targeted Ahmadis, heterodox Muslims, and in 2008 the government issued a vague decree that seemed to even sanction their persecution. Before the massive demonstrations against Ahok, Jokowi did not focus on the rising threat of political Islam, instead devoting his energies to programs designed to boost the economy, reduce red tape, and bolster social welfare safety nets.

The self-proclaimed Islamic State, too, has focused on recruiting Indonesians and Malaysians online and in person.

However, some of the developing support for political Islam is organic. Islamists have taken advantage of the weak public school systems in Indonesia and Malaysia, building decent, religiously oriented schools and, as a result, instilling young people with more conservative values. Some nine hundred new private Islamic schools reportedly opened in Malaysia between 2011 and 2017. Indonesian Islamist groups also have become skillful organizers on social media. As I note in a new Council Special Report on U.S.-Indonesia relations, the self-proclaimed Islamic State, too, has focused on recruiting Indonesians and Malaysians online and in person. According to some estimates, more than one thousand Southeast Asians, including many from Malaysia and Indonesia, traveled to fight for the Islamic State in Iraq and Syria. Some of those fighters are now returning home.

High inequality rates and rampant graft also steer more support toward conservative influencers. Although the two countries’ economies have performed solidly in recent years, they remain highly unequal societies and graft is endemic. Some Islamist parties, such as PAS, portray themselves as fighting against corruption and are seen by some voters as credible, at least compared to the ruling coalition in Malaysia. (Indonesian religious parties have weathered more corruption scandals in recent years.)

In addition, in Indonesia, where the government has overseen a decentralization of political power away from Jakarta over the past twenty years, Islamists have benefited. They have built political strength in more conservative areas, such as Aceh and West Java, and in turn encouraged local and regional governments to embrace policies in favor of sharia-based laws.

The Costs of an Islamist Wave

The rise of Islamism in Malaysia and Indonesia could have severe consequences for the two states’ societies, political systems, and overall stability. Already, there have been deadly attacks by Islamic State-inspired militants in Jakarta, in January 2016 and May 2017. Indonesian and Malaysian militants also mount attacks in neighboring countries. Indonesian fighters have been arrested in Marawi, the city in the southern Philippines where the army fought an Islamic State-linked group last year, and six Indonesian militants were detained in 2016 for allegedly planning a terrorist attack in Singapore.

Perhaps even more dangerous for Indonesia’s future, religious hard-liners are apparently building alliances with Prabowo Subianto, a former lieutenant general who was Jokowi’s opponent in the 2014 presidential election. Prabowo appears to be laying the groundwork for a populist-military-Islamist alliance for the 2019 election. This partnership was already starting to take form in 2016 and 2017. Prabowo’s top allies allegedly played a major role in helping foment the mass anti-Ahok protests. In 2014, Prabowo openly disdained Indonesia’s democratic progress and cast himself as a populist strongman. Since the anti-Ahok rallies, he seems to be solidifying his alliance with religious hard-liners, probably in preparation for 2019.

Malaysia and Indonesia need to combat graft by strengthening the power and independence of anticorruption investigators.

Next year, Prabowo could rely upon support from Islamist groups and voters who like his military background and strongman style. If he wins the presidency, he could roll back democratic freedoms—the prospect of Prabowo winning next year is sparking concern among many Indonesian moderates as well as other leaders in Southeast Asia.

In Malaysia, if Najib wins the 2018 election with help from hard-liners, he could further polarize Malaysian society and politics. Ethnic and religious minorities could continue Malaysia’s serious talent and capital drain; minorities have been leaving for Singapore, Australia, and other countries. In both states, if the rise of hard-liners endangers political stability, it could threaten strategic ties with the United States. Malaysia is an important ally in the regional anti-Islamic State battle, while both countries are major regional trading partners with the United States.

Safeguarding Freedoms

The two governments can take several steps to prevent Islamist groups from undermining secular, democratic norms. Jokowi should reject the temptation to woo hard-liners in ways that sacrifice secularism. Moreover, the governments, which have generally warm ties, should increase cooperation with each other, as well as with the United States, the Philippines, and Singapore, to track militants linked to the Islamic State. They should apply rigorous scrutiny to charitable organizations from Saudi Arabia, according to Indonesia expert Margaret Scott, who has done some of the most in-depth research on Saudi donations in Indonesia.

Separately, Malaysia and Indonesia need to combat graft by strengthening the power and independence of anticorruption investigators and invest in school systems as an alternative to foreign-funded and religious schools. They also need to pursue policies more targeted at reducing income inequality.

Neither Jakarta nor Kuala Lumpur can completely halt the rise of hard-line groups. When Islamists are integrated in the democratic process, such as by winning local elections, they should be encouraged to continue operating within the system. Jakarta should crack down on militants’ vigilante activities but otherwise proceed cautiously in efforts to oversee the democratic participation of energized hard-line groups.