The leaders wound up a two-day summit of the Organisation of the Islamic Conference (OIC) pledging to "update national laws to criminalise all acts of terrorism as well as its financing and incitement".
In a Mecca Declaration read out in a final session, they also called upon their peoples to "combat forcefully the preachers of sedition and deviation, who aim to distort the peaceful principles of Islam".
Saudi Foreign Minister Saud al-Faisal said that the Muslim leaders who met in Mecca, western Saudi Arabia, had agreed to "combat terrorism and extremism and stressed the moderate nature of Islam".
They stressed the need to stop blaming outside forces for problems in the Muslim world and focus on cooperation, he said.
"(They agreed) on stressing the importance of cooperation between Muslims and putting an end to complaints of foreign conspiracies, and concentrating on common efforts to face development challenges."
Call for moderation
The summit opened with a call from regional powerhouse Saudi Arabia for moderation and tolerance and a rejection of extremist violence.
"Islamic unity would not be reached through bloodshed as claimed by the deviants," said King Abdullah, whose country hosts the headquarters of the 57-member OIC.
King Abdullah was referring to Islamist extremists, notably the Al-Qaeda network of Saudi-born Osama bin Laden which has claimed attacks across the globe, including in Saudi Arabia.
He called on the Islamic jurisprudence arm of the OIC to "fulfill its historic role of combating extremism."
He also called for a reform of educational programmes in Islamic nations, which are facing US pressure to change school textbooks that Washington has criticised as intolerant.
The United States has been pushing for an initiative to encourage democratic reform and economic liberalisation in Arab and Muslim countries in a bid to abate the frustration and poverty on which terror is thought to thrive.
But Muslim leaders expressed concern over the "widespread phenomenon of hatred and antagonism against Islam."
They also called for "greater and coordinated international efforts" to combat terrorism.
Sectarian divisions
The summit allowed the leaders of Saudi Arabia and Iran to meet for the first time since a public row over Riyadh's accusations that Tehran was meddling in war-torn Iraq.
King Abdullah held talks Wednesday with Iranian President Mahmoud
Ahmadinejad, who was making his first visit since taking office in August.
Later both walked side by side with other leaders as they walked around Mecca's Kaaba shrine seven times according to Islamic rites.
The dispute, which erupted after years of improving relations between
Shiite Iran and Sunni-ruled Saudi Arabia, led Iranian Foreign Minister Manouchehr Mottaki to scrap a planned visit to Saudi Arabia in October.
In an attempt to address sectarian divisions among Muslims, an article which bans accusations of apostasy being leveled at certain groups was added to a 10-year "plan of action to confront the challenges of the 21st century."
The article, which appears aimed at reducing tension between Sunni and Shiite Muslims, stressed "the correct belief of Muslim groups ... as long as they believe in God ... and all principles of Islam."
Ultra-conservative Sunni groups, mainly Saudi Wahhabists, refer to Shiites as "rejectionists" and consider their beliefs non-Islamic.
