By Daniel Serwer

The views expressed are his own.

In a trip to Libya this month, just weeks after Muammar Qaddafi’s fall, I found peace coming fast to Tripoli, despite continued resistance in several Libyan towns. Ten days ago, families with children mobbed Martyrs’ square, where Qaddafi once held forth, to commemorate the hanging 80 years ago of Libya’s hero of resistance against the Italians, Omar Mukhtar. Elementary schools opened last week. The university will open next month. Water and electricity are flowing. Uniformed police are on the street. Trash collection is haphazard but functioning.

This is the fastest post-war recovery I have witnessed: faster than Bosnia, Kosovo, Iraq or Afghanistan. Certainly faster than Somalia, Sierra Leone or Rwanda.

Why this rapid recovery in a country marked by four decades of dictatorship? Why does Libya seem on track while Egypt seems to have gone off the rails?

Libya has at least three important advantages: good leadership and clear goals at the national and local levels, careful planning and adequate resources.

Libyans believe Mustafa Abdel Jalil, who leads the National Transitional Council (NTC), is uncorrupted and uninterested in continuing in power. He has pledged not to seek future office. He has visited the liberated cities to celebrate the single goal of freeing Libya from the Qaddafi regime. The NTC has replaced Qaddafi’s green flag with the red, black and green banner emblazoned with the star and crescent that was Libya’s flag at independence. The revolution in Libya was not interested in compromise or a managed transition. It wanted a clean break: Qaddafi out and a new, more democratic regime, in.

The NTC and a clandestine Tripoli local council planned carefully for the military takeover of Tripoli and the restoration of services in the aftermath. With three hundred mosques playing CDs chanting “Allahu akbar!” Qaddafi’s forces on the evening of August 20 found themselves confused and then attacked from both inside and outside the city, which fell far more easily than anticipated.

In the weeks since, the new, unpaid local administration has achieved a great deal. It sent technicians hundreds of kilometers to the south with support from local tribesmen to reactivate the wells that pump water into Qaddafi’s “Great Man-made River,” which supplies Tripoli and other population centers. The national government is making the usual social welfare payments. Flour and oil subsidies have been maintained, so bread is cheap and available. Only partial withdrawal of salaries from banks is permitted, but Libyans are confident about the country’s economic future, based on its oil and gas resources.

Libyans know what to expect next. The NTC has promised elections for an interim assembly by April 2012 and presidential elections by April 2013. It has published a constitutional framework that establishes Libya as both Islamic and democratic.

The contrast with Egypt, where I spent a week earlier this month, is striking. Egypt is a much larger, more complicated and poorer country. There unity around the demand for President Hosni Mubarak’s resignation deteriorated quickly once he resigned. Little planning had been done.

The protesters asked the army to take over. Unprepared, it had to postpone elections even as the protest movement split, with secularists demanding a constitution, or at least constitutional principles, before elections and Islamists preferring it the other way around. Egyptians now do not know what to expect, though the first round of elections is now promised for November.

Some of the protesters have now targeted Israel, diverting attention from Egypt’s own problems and scaring off European and American tourists. The economy is in a nose dive. Resources are highly constrained.

Things could go wrong in Libya. We are still in the early days. Qaddafi’s forces could go underground and conduct the kind of insurgency that Saddam Hussein’s secret services ignited in Iraq. Fighting could erupt among the many militias that constitute the NTC’s military forces. Many of them came from outside Tripoli. They may refuse to go home or to disarm.

But Libya is less than one-tenth the population of Egypt and has vast funds deposited abroad by Qaddafi that are beginning to flow to the NTC. If Qaddafi’s forces can be defeated soon and the militias either integrated into a new Libyan army or demobilized and disbanded, there is real hope for success. Libyans, who have lived under an idiosyncratic and cruel dictatorship for more than forty years, deserve no less.