Islamic extremists must not be allowed to pervert fledgling democracies and persecute minorities, David Cameron has warned.
Delivering a speech in Indonesia, the Prime Minister praised the country as proof that the religion was compatible with democracy.
He insisted the shift away from authoritarianism made by the world's most populous Muslim state was an example to those caught up in the Arab Spring.
But Cameron also highlighted the dangers facing new democracies such as Egypt, where Islamic political parties have significant support:
"Let me be absolutely clear: I am not talking about Islam. Islam is a religion observed peacefully and devoutly by over a billion people," he told students at Al Azhar university in Jakarta.
"And let me also be clear: extremism is not only found among Muslims.
"But there is a problem across the globe with Islamist extremism which is a political ideology supported by a minority.
"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.
"From Afghanistan to Iraq and from Bali to London, we have seen all too often that this extremism feeds prejudice, persecution and dreadful acts of terror and violence.
"These extremists try to turn Islam into a closed and warped ideology that is opposed to democracy.
"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.
"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."
Cameron said Indonesia's decision to enshrine individuals' rights into its constitution reflected the "vital importance" of protecting minorities.
The speech came as the Prime Minister continued his trade mission in South East Asia, which started in Japan on Monday.
He held talks with President Susilo Bambang Yudhoyono in Jakarta yesterday as part of efforts to deepen links with the fast-growing economy.
But he suffered an embarrassing moment when his host suggested that boosting government spending and preventing companies laying off staff was the best way to fix a wrecked economy.
And after they unveiled a £326m deal for Indonesian airline Garuda to buy 11 Airbus A330s, Cameron faced criticism that his opposition to expansion at Heathrow meant the planes would not be able to fly direct to the UK.
Later on Thursday Cameron will take his whirlwind tour to Malaysia, before rounding off the week with trips to Singapore and finally Burma.
While there, he is due to become the first western leader to meet Nobel Peace Prize winner Aung San Suu Kyi since she was elected to parliament this month.
Asked if it was too early to assume that democratic reforms in the country would continue, he replied: "There are never guarantees but of all the bad things that are happening in our world, I think Burma is a bright spark, where you see an inspirational leader who has been so patient and hard working and wanting to see democracy flower in that country, we see that flowering taking place.
"I think it is a good time to go and visit and I am looking forward to doing that.
"Britain has helped put huge pressure and sanctions on that regime and I think there will be opportunities now to work with Aung San Suu Kyi and make sure that process is irreversible."
Some of the 35-plus business leaders in the delegation accompanying the premier are due to travel to Burma.
But Downing Street has insisted that the visit is purely political and they will merely be undertaking "cultural" activities.
Britain's policy of not encouraging trade with Burma remains in place, according to No 10, with EU ministers due to consider easing sanctions over the coming weeks.
Suggested For You
SUBSCRIBE AND FOLLOW
Get top stories and blog posts emailed to me each day. Newsletters may offer personalized content or advertisements.Learn more