At a time when democracies are under stress in diverse nations–Thailand, Ukraine, Zimbabwe, Nicaragua, to name a few–one bright spot has emerged in the Indian Ocean. The president of Maldives, Maumoon Abdul Gayoom, who has been in power for as long as Robert Mugabe in Zimbabwe, not only allowed the country’s first democratic, multiparty election to take place but walked away gracefully on Tuesday when he lost a runoff vote to a man he had jailed more than once.

“I have accepted the will of the people,” Gayoom, 71, said as he stood next to his successor, Mohamed Nasheed, 41. “My legacy is going to be introducing a modern, liberal form of democracy. That is the greatest legacy anyone can give.” For his part, Nasheed, who is known as Anni and who has been the leader of a democracy movement that was ruthlessly suppressed only a few years ago, said he would not prosecute Gayoom, whom he has accused of corruption.

A lot of Maldivians may harbor a bit of skepticism about how long this amity will last, and there will be purists, not all of them in Maldives, who will damn the decision to let Gayoom off the hook. But for now the seemingly effortless transition caps decades of social and economic growth in a small country, with more than 1,000 islands and 300,000 people, about the same population as Iceland. With limited natural resources beyond a breathtaking tropical ocean setting, Maldives has risen to the top ranks of South Asian nations in human development.

Maldivians, a mixture of Arabs, several ethnic groups from the Indian subcontinent and Sinhalese people like those in nearby Sri Lanka, are 100 percent Sunni Muslim by law. Yet adults are almost universally literate, and girls go to school on a parity with boys. Women make up 52 percent of the labor force; maternal mortality stands at seventy-two deaths in 100,000 births. (India’s rate is about 300 per 100,000 births.) Even with the economic crisis spreading worldwide, the United Nations and International Monetary Fund expect the growth rate in Maldives to top 6 percent this year. By 2011 Maldives will graduate into the ranks of middle-income countries. Environmentally friendly luxury tourism and fishing are the economic mainstays.

All of this has been achieved while facing the terrifying possibility that much of the country could sink under the waves if global warming raises ocean levels as predicted. The capital, Male, is already buttressed by sea walls. The Indian Ocean tsunami in late 2004 hit Maldives hard, setting back the country’s goal of effectively eliminating poverty. Scattered tourist resorts were crippled. Structures of all kinds were destroyed, boats and docks were lost and cropland and fisheries were devastated. The UN Development Program estimated the losses at about $470 million. To help Maldives restore its infrastructure and economy, UNDP began an “adopt an island” program to raise aid money.

The story of Maldives illustrates some paradoxes that arise in building and sustaining democracies, still a work in progress globally. Without full political rights, Maldives was a pariah. (It only recently signed international treaties on political and human rights.) But even a casual visitor could meet outspoken critics of the government. Gayoom, an autocrat who did all he could to stifle political development, has nevertheless delivered to one of his arch foes a country with real achievements and promise, tsunami damage notwithstanding. If the departing president, whose fingers were in a lot of economic pies, will truly stand back and let Nasheed govern after his inauguration on November 11, Maldives will have set an example that rulers like Mugabe would have been wise to adopt a lot earlier. Bringing a country down around one’s head rather than relinquish power is not much of a legacy. Perhaps Gayoom was thinking about his place in history.