David Cameron arriving in Indonesia on Wednesday, the day before his major speech on Islam and democracy. Photograph: Agung Kuncahya B/Xinhua Press/Corbis

Democracy and Islam can flourish together, David Cameron will declare on Thursday as he uses a landmark speech in Indonesia to tell the Muslim world that it can reject a "dead-end choice" between extremism and dictatorship.

In one of his most significant speeches on Islam, the prime minister will say that the world can defeat extremists, who are a "dangerous foe" on a par with supporters of slavery.

Cameron will hail the "extraordinary journey" undertaken by Indonesia, the world's largest Muslim country, since the end of the Suharto dictatorship in 1998 as an example of the "inspirational path" countries can follow.

"What Indonesia shows is that in the world's largest Muslim-majority country, it is possible to reject this extremist threat and prove that democracy and Islam can flourish alongside each other," the prime minister will tell students at Al-Azhar University in Jakarta. "That's why what you are doing here is so important, because it gives heart to those around the world who are engaged in the same struggle."

Downing Street regards the prime minister's speech as one of the highlights of his trip to Asia as the visit moves from a trade mission to focus on politics. The main highlight will come on Friday when the prime minister becomes the first western leader to go to Burma since Aung San Suu Kyi's recent success in a series of parliamentary byelections.

In his speech on Thursday, the prime minister will pay tribute to Aung San Suu Kyi and to the Burmese president, Thein Sein, who faced down conservatives to allow Aung San Suu Kyi's National League for Democracy to contest the recent elections. Cameron, who will visit the president in the Burmese capital of capital Naypyidaw and Suu Kyi in Rangoon, will say: "Where reform is beginning, like in Burma, we must get behind it. So let's pay tribute to those who have for decades, and at huge personal cost to themselves, fought for that freedom and reform. Not least, of course, the inspirational Aung San Suu Kyi.

"Let's pay tribute also to the leadership of President Thein Sein and his government, which has been prepared to release political prisoners, hold byelections and legalise political parties that had previously been outlawed. And let's show that when they have the courage to reform, we have the courage to respond."

The prime minister's visit to Burma is likely to have an immediate impact as it accelerates moves towards the scaling-down of sanctions against the country. His speech in Indonesia will address one pressing issue – Syria – but also sketch out what he sees as a longer-term challenge facing the whole world, which, he will say, needs to join together to face down four major threats to democracy. On Syria, the prime minister will say that the determination of President Bashar al-Assad to remain in power risks a civil war. "Where cries for reform are being resisted and the people are being repressed – just as they are today in Syria – we must oppose the authoritarian. Because the longer Assad stays, the more dangerous things become for his people and the greater the likelihood of a bloody civil war."

Cameron will label Assad as one of the world's "dangerous foes" who follow in an ignoble historical tradition. "Wherever [the] vision of democracy and citizenship has been advanced, it has encountered dangerous foes. From slavery in America to the civil rights movement a century later. From apartheid in South Africa to the situation in Syria today."

The prime minister will identify four groups he believes are determined to defeat democracy:

• Authoritarian leaders. Cameron will cite Muammar Gaddafi, Hosni Mubarak, the former Tunisian president Zine al-Abidine Ben Ali and Assad as he says: "In each case the Arab spring has shown that denying people their rights in the name of stability and security actually makes countries less stable in the end. Over time, the pressure builds up until the people take to the streets and demand their freedoms."

• Corrupt elites. Cameron will cite the Tunisian official who prompted the fruit seller Mohammed Bouazizi to set himself alight after refusing to let him sell his goods. "Corruption denies the people their economic and political stake – the citizenship, the job and the voice that they want. Worse still, it breeds a cynicism and a sense of rage."

• Extremists. The prime minister will say he is not talking about Islam, which he will describe as a "religion observed peacefully and devoutly by over a billion people", and he will also make clear that other religions attract extremists. But he will say: "There is a problem across the globe with Islamist extremism, which is a political ideology supported by a minority." And he will go on to condemn "extremists – some of whom are violent – and all of whom want to impose a particular and very radical, extreme version of Islamism on society to the exclusion of all others. And this total rejection of debate and democratic consent means they believe that democracy and Islam are incompatible."

He will identify an early test as he challenges the Muslim Brotherhood in Egypt to guarantee the rights of other religions. "The world will expect them to live up to the commitments they have made to protect the rule of law for all citizens, to defend the rights of the Coptic Christians and minority groups and to accept that democracy means they will be held accountable in the courts, and that they should not pervert the democratic process to hold on to power should the will of the people change."

• Tribalists. The prime minister will cite Northern Ireland's past as an example of the "poison" of tribalists who discriminate against other groups.