Editor's note: William J. Bennett is the Washington fellow of the Claremont Institute. He was U.S. secretary of education from 1985 to 1988 and was director of the Office of National Drug Control Policy under President George H.W. Bush.

(CNN) -- Libya is a mess. It has been a mess for a long time, but as with other states in the Middle East, it was not always so. As Fouad Ajami put it, "Libya was a wealthy country, blessed with abundant oil, but the despot turned it into one of Africa's poorest populations. ...The country was turned into a cruel tyranny, and what wealth existed was the prerogative of the man at the helm and his children."

Much the same could be said of other regimes throughout the Middle East.

So we rightfully will celebrate when Gadhafi -- whom Ronald Reagan once called "the mad dog of the Middle East" -- is finally and fully deposed. But the celebrations here and abroad are premature. On Monday morning, it was reported that two of Gadhafi's sons had been captured by the opposition in Libya, including his eldest, Saif al-Islam. By Monday night, Saif was roaming free, "flashing V-for-victory signs." As the Polish poet Stanislaw Lec once put it, "When you jump for joy, beware that no one moves the ground from beneath your feet."

There are plenty of other reasons to be cautious. The question of "Who and what comes next?" is too easily dismissed by too many. It is this question, more than any other, that has dogged our fight in the global war against Islamic terror from the very beginning.

We rightfully celebrated the ousting of the Taliban in Afghanistan, but today it is unclear whether the Taliban will be coming back to power, or if Hamid Karzai is the ally we once thought he would be, as he threatens to join with our enemies. And, of course, Afghanistan's Constitution speaks of "jihad" and states "no law can be contrary to the beliefs and provisions of the sacred religion of Islam."

In Iraq, much the same is true of Nuri al-Maliki and the Iraqi government. Most recently, Maliki coddled the Syrian regime in the midst of its crackdown and, for the past few years, has moved ever closer to Iran and Mahmoud Ahmadinejad. Meanwhile, the Iraqi Constitution also states, "No law may be enacted that contradicts the established provisions of Islam."

So what will come next in Libya? It is a sign of our failed intelligence operations that we do not have a good grasp of who and what constitutes the opposition there. But there is credible evidence that true democrats constitute only a minority of the opposition. Additionally, the drafted constitution for the new Libya states that Islam will be "the religion of the state" and the "principal source of legislation is Islamic jurisprudence (Sharia)."

One early test of the new Libya will be the disposition of Abdel Basset Ali Megrahi, the Libyan terrorist responsible for blowing up Pan Am Flight 103, and whether he will be extradited to the United Kingdom or the United States. He was freed from prison in the UK two years ago and has been living freely in Libya ever since.

But the true test of all the uprisings we have seen this year, from Egypt to Syria to Libya, is not exclusively about what happens in those countries but whether the United States will finally get morally serious about promulgating a consistent foreign policy toward them.

Right now, there is no plausible explanation as to why we would push Mubarak out, while we held our counsel during Iran's uprising. There is no plausible explanation as to why we would activate NATO against Libya, while we coddled Syria for so long (including sending an ambassador to Damascus and saying positive things about the Assad regime.)

Not all of our mistakes are President Obama's doing. It is worth recalling that while Americans have universally heralded the end of the Gadhafi regime based on his reign of terror and brutality, it was President Bush who restored diplomatic relations with Libya and took it off the state sponsors of terrorism list.

But, just now, as we cheer what looks like the "mad dog's" fall, let us recall, as Shakespeare put it: "the worst is not, so long as we can say 'This is the worst.'" That is sadly, likely, the case in Egypt.

Let us retool and rethink so such will not happen again elsewhere. It is long past time for a moral consistency, it is long past time for a better intelligence apparatus throughout the Middle East where the CIA needs to "lift its game," and it is long past time we instruct our putative and potential allies in the virtues and principles of the kinds of revolutions that do not devour their own children. That starts with, but does not end with, one of the most esteemed precepts of our nation's own founding -- the separation of church and state.

A revolutionary regime basing its law on the precepts of Islam, or a country where the Muslim Brotherhood is poised to take more and more power, is simply not what we should be promoting. Nor are such organizations of power in the interest of the oppressed, who truly do want genuine freedom.

The opinions expressed in this commentary are solely those of William Bennett.