Abdurrahman Wahid, who died last week at the age of 69, was the first democratically elected president of Indonesia, the world's fourth largest country and third largest democracy. It has the largest Muslim population of any country in the world. Although he was forced from office after less than two years, he nevertheless helped to set the course of what has been a remarkably successful transition to democracy.

Even more important than his role as a politician, Wahid was the spiritual leader of Nahdlatul Ulama, the largest Muslim organization in Indonesia, and probably in the world, with 40 million members. He was a product of Indonesia's traditionally tolerant and humane practice of Islam, and he took that tradition to a higher level and shaped it in ways that will last long after his death.

Wahid recognized that the world's Muslim community is engaged in what he called in a 2005 op-ed for this newspaper "nothing less than a global struggle for the soul of Islam" and he understood the danger for Indonesia, for Islam and for all of us from this "crisis of misunderstanding that threatens to engulf our entire world."

Wahid was one of the most impressive leaders I have known. Although his formal higher education was limited to Islamic studies in Cairo and Arabic literature in Baghdad, his breadth of knowledge was astounding. With a voracious appetite for knowledge and a remarkably retentive memory, he seemed to know all of the important Islamic religious and philosophical texts. He also loved reading a wide range of Western literature (including most of William Faulkner's novels) as well as Arabic poetry. He enjoyed French movies, and cinema in general, and could identify the conductor of a Beethoven symphony simply by listening to a recording. He was an avid soccer fan and once compared the different styles of two German soccer teams to illustrate two alternative strategies for economic development. He loved jokes, particularly political ones. During Suharto's autocratic rule he published a collection of Soviet political humor in Indonesian, with the obvious purpose of teaching his own people how to laugh at their rulers.

Despite all that learning, Wahid had a common touch that enabled him to express his thoughts in down-to-earth language. He thus gained broad legitimacy for a moderate and tolerant vision. He could speak to young Indonesians, grappling with the relationship between religion and science by explaining to them the thoughts of a medieval Arab philosopher like Ibn Rushd (known to Christian philosophers as Averroes). And he was all the more effective because he himself had grappled with controversial ideas.

Wahid had been somewhat attracted in his youth by the writings of Said Qutb and Hasan al Banna, the founders of the Muslim brotherhood, but his deep humanism led him to reject them. When I visited him recently he told me of a long-ago visit to a mosque in Morocco where an Arabic translation of Aristotle's "Nichomachean Ethics" was on display. Seeing that book had brought tears to his eyes and Wahid explained: "If I hadn't read the 'Nichomachean Ethics' as a young man, I might have joined the Muslim brotherhood."

No doubt, what had so impressed Wahid was that Aristotle could arrive at deep truths about matters of right and wrong without the aid of religion, based simply on the belief that "the human function is activity of the soul in accord with reason" (Nichomachean Ethics, Book I). But his tears must have reflected the thought of how close he had come to accepting a cramped and intolerant view of life and humanity.

Throughout his public career, three ideas were central to Wahid's thinking. First was that true belief required religious freedom. "The essence of Islam," he once wrote, is "encapsulated" in the words of the Quran, "For you, your religion; for me, my religion." Indonesia, he believed, needs "to develop a full religious tolerance based on freedom of faith." Second was his belief that the fundamental requirement for democracy—or any form of just government—is equal treatment for all citizens before the law. Third, that respect for minorities is essential for social stability and national unity, particularly for Indonesia with its extraordinary diversity.

Throughout his career Wahid spoke up forcefully for people with unpopular ideas—even ones he disagreed with—and for the rights of ethnic and religious minorities. He was admired by the Christian and Chinese minorities for his willingness to do so. One of his first acts as president was to participate in prayers at a Hindu temple in Bali where he had earlier spent several months studying Hindu philosophy. Later he removed a number of restrictions on ethnic Chinese and made Chinese New Year an optional national holiday.

Even after leaving office, Wahid's role as a defender of religious freedom was extremely important. Indonesian voters have rejected extremist politics at the polls—and the leadership of the current president, Susilo Bambang Yudhoyono deserves much credit for that. Nevertheless, extremist views and even violent extremism too often go unchallenged. A recent report from The Wahid Insitute (which he founded in 2004) notes that a minority with extremist views, now in control of the Indonesian Ulama Council, has issued religious rulings against "deviant" groups. An even smaller minority that espouses violence, particularly the Islamic Defender Front, has attacked Christian churches and the mosques of the small Muslim Ahmadiyah sect.

Wahid was one of the few prominent Indonesians to defend the rights of the Ahmadiyah or to speak out forcefully against the Islamic Defender Front. Doing so takes courage. But he was always courageous, whether in defying President Suharto at the height of his power or in his personal struggle against encroaching blindness and failing health.

Although optimistic that "true Islam" will prevail, as he wrote in his 2005 op-ed, Wahid did not underestimate the dangers facing the world from an "extreme . . . ideology in the minds of fanatics" who "pervert Islam into a dogma of intolerance, hatred and bloodshed" and who justify their brutality by declaring "Islam is above everything else." This fundamentalist ideology, he said, "has become a well-financed, multifaceted global movement that operates like a juggernaut in much of the developing world." What begins as a misunderstanding "of Islam by Muslims themselves" becomes a "crisis of misunderstanding" that afflicts "Muslims and non-Muslims alike, with tragic consequences."

No one who knew Abdurrahman Wahid can believe that those fanatics who preach hatred and violence speak for the world's Muslims. Even though the extremist ideology represents a distinct minority of Muslims, it is well-financed and well-organized. To confront it, Muslim leaders like himself need, as he wrote in 2005, "the understanding and support of like-minded individuals, organizations and governments throughout the world . . . to offer a compelling alternate vision of Islam, one that banishes the fanatical ideology of hatred to the darkness from which it emerged."

That support includes material support, but it also includes the moral support that comes from international recognition and attention for Muslim leaders who speak out with the courage that Wahid did.

When Wahid was only 12 he was riding in a car with his father, Wahid Hasyim, himself a prominent Muslim leader at the time of Indonesian independence, when the car slid off a mountain road and his father suffered fatal injuries. What Wahid most remembered from that tragic event was the sight of thousands of people lining the roads as his father's casket traveled the 80 kilometers from Surabaya to his burial at Jombang. Overwhelmed by the affection people had for his father, he wondered "What could one man do that the people would love him so?"

As the funeral procession for Wahid himself traveled the same route on the last day of 2009, thousands of mourners, deeply moved, again lined the road. What had he done that Indonesians so loved him? Perhaps the question is answered by the words that he asked to have on his tomb: "Here lies a humanist." That he was and a great one as well. No one can replace him, but hopefully he has inspired others to follow in his path.

Mr. Wolfowitz, a former U.S. ambassador to Indonesia and assistant secretary of state for East Asia, is a visiting scholar at the American Enterprise Institute.