On the face of it, the similarities of the undoing of the terrible regimes of Saddam Hussein and Moammar Gadhafi are striking. The spectacles of joy in Tripoli today recall the delirious scenes in Baghdad's Firdos Square in 2003—the statues pulled down, the palaces of faux grandeur and kitsch ransacked by people awakening to their own sense of violation and power, the man at the helm who had been full of might and bravado making a run for it, exposed as a paranoid and pretender, living in fear of his day of reckoning.
In neither case had the people of these two tormented societies secured their liberty on their own. In Baghdad, the Baathist reign of terror would have lasted indefinitely had George W. Bush not pushed it into its grave. There had been no sign of organized resistance in that terrified land, not since the end of the 1991 Gulf War and the slaughter that quelled the Shiite uprising.
Libya offered its own mix of native resistance and foreign help. A people who had been in the grip of a long nightmare saw the Arab Spring blossom around them. On their western border, the Tunisian kleptocracy had fallen and the rapacious ruler and his children and in-laws had scurried out of the country. Ruler and ruled in Libya saw themselves in the Tunisian struggle, for Gadhafi had been an ally of the Tunisian strongman.
But it was Egypt, the big country on Libya's eastern frontier, that shook the Libyan tyranny. In February, after a popular insurrection that held the Arab world enthralled, Hosni Mubarak bent to his people's will and relinquished power. Six days later a spark caught fire in Benghazi, Libya's second-largest city. A reluctant American president was pulled into the fight. Gadhafi's fate was sealed—NATO would function as the air force of the rebellion.
Fast forward to last week. No sooner had the notorious Gadhafi compound of Bab al-Aziziyah fallen than the Obama administration claimed that its policy of "leading from behind" and its "multilateralism" had proven more effective than George W. Bush's campaign in Iraq. This was to be expected, and in the nature of political things.
But Libya is not the historical knot that Iraq was, and for all the surface similarities, Gadhafi was never the menace that Saddam had been. In stark contrast to the challenges faced by Iraq, fair winds attend this Libyan venture.
Begin with Libya's "easy" borders and immediate neighborhood. Algeria excepted, the countries contiguous with Libya are at peace with the victory of the rebellion. Indeed, Libya's two most important neighbors—Tunisia and Egypt—rightly see the new order there as an extension of their own rebellions. Realism prevails in both Tunis and Cairo; Libya is seen as vital to their own economic prospects, a magnet for their surplus labor.
To Libya's south, Niger and Chad—places where Gadhafi had bought loyalty with his abundant treasure—have signaled their acceptance of the new order, as has Sudan to the east. The Algerian opposition to Libya's rebellion is of little consequence. The military regime there is bereft of any meaningful legitimacy and is seen as just another despotism whose leaders sullied the honor of their country by their dealings with Gadhafi. The welcome mat rolled out in Algiers for Gadhafi's wife, vengeful daughter, and two of his sons is further proof of this.
The Iraqis should be envious. Their new order, midwifed by the Americans, had been delivered into a hostile environment. The neighborhood was treacherous. To the east bulked Iran, presumably a Shiite sister republic of the new Iraq but in truth a spoiler determined to thwart the American project there. Those in the know understood that the Shiite faith could never bridge the Arab-Persian divide, and that Iran would be a burden on post-Saddam Iraq and its leaders.
To the West, there was the Syrian regime. There but for the grace of God go we, the Syrian rulers thought. Syria presented an exquisite illustration of political cynicism—an Alawite tyranny providing a conduit into Iraq for Sunni jihadists from all Arab lands drawn by the thrill of battling and killing American soldiers and Iraqi Shiites. To divert attention from itself at a time of its own panic and vulnerability, Syria's regime did all it could to set Iraq ablaze.
Everywhere Iraqis looked there was trouble. The Turks had schemes of their own and proxies in Iraq (the Turkomen community), and they were keen to monitor and limit the aspirations of the Kurds. Jordan was hostile. Saddam had long been a hero in that country, and the Sunni pan-Arab doctrines had long held sway among Jordanians and Palestinians alike in that binational state.
Nor were the two most influential Arab states, Egypt and Saudi Arabia, favorably disposed toward the new Iraq. To the rulers in Cairo and Riyadh, the jumbled mix of freedom and tumult, and the defeat of the Iraqi Sunnis, were heralds of trouble. Iran was pushing ever deeper into Arab affairs, the balance of power in the region was being altered. There had been uncontested Sunni primacy in Arab lands, but Baghdad—a city of great meaning and consequence in Arab-Islamic history—had fallen to the Shiite stepchildren, and the Americans had brought it all about.
Libya is blissfully free of the poison of that primitive Sunni-Shiite schism. The deranged ruler who had tormented the Libyans had shown Islam no regard—he was thoroughly irreligious. He fought the religious class and offended the faithful in every way he could. His hallucinatory Green Book—understood to be ghostwritten by a hired Lebanese writer—was seen by him as the scripture of a revolutionary society cut off from its past.
But the birth pangs of the new Libya are far from over. The hunting down of Gadhafi and his two closest sons will be a boon to the new government. On the run, Gadhafi can't ignite an insurgency in the way the Baath remnants did in Iraq, and there is no large community invested in Gadhafi as Iraq's Sunnis were in Saddam. Still, the damage of four decades in a claustrophobic society terrorized by "revolutionary committees" and a rotten system of informers will take time to repair.
"We don't want to repeat the example of Baghdad," Mahmoud Jibril, the No. 2 man in Libya's National Transitional Council, said last weekend as he sought funds to keep the country afloat, to restore services, to pay civil servants. Fair enough. The Iraqis did not perform brilliantly in the aftermath of their liberation. And the American regency should have handed over power earlier to the Iraqis to run their own sovereign affairs. But for all its troubles, who in good conscience can deny that a better, more humane order holds in that country today?
The Libyans are lucky. They have wealth and a favorable location close to Europe. And, for what it's worth, they have the Iraqi example of what works and what doesn't once the tyrant and his statues have fallen.
Mr. Ajami is a senior fellow at Stanford University's Hoover Institution and co-chairman of Hoover's working group on Islamism and the International Order.