Victory in Libya: President Obama’s “shared leadership” approach to the crisis has worked -- so far. But can it resolve the next challenges? Photo: AP

After nearly three years of American indecision and failure, Libya is helping an Obama Doctrine to emerge. Call it the Goldilocks foreign policy — not too hot, not too cold.

Why? Success. Just in time for President Obama’s re-election campaign, he can claim an important scalp. Dead or alive, Moammar Khadafy becomes a notch on Obama’s belt right next to Osama bin Laden.

In Libya, as Obama’s fans will tell anyone who’ll listen, we got it just right: Tyranny ended without too much US involvement, but enough.

So, as we move now to the next stage, it’s much harder to claim those Libyan rebels are puppets of Western imperialism, a tool in capitalism’s lust for oil — or any of the tropes that usually “taint” America’s allies.

This, with little American treasure spent, and no American blood spilled.

Yes, Obama’s critics accuse the president of doing too little, and therefore allowing the Libyan war and suffering to last too long. Are we wrong? For now, it’s difficult to argue with success.

And, to be fair, America has been doing much more to help the Libyans than meets the eye.

True, we ceded military leadership to the Byzantine NATO chain of command. But US assets — intelligence, planes, drones and apparently some special forces — were vital to the rebels’ victory. And Americans helped shape a group of ragtag Libyan rebels into a semi-organized fighting corps.

We’re still at it. Americans are reportedly helping the forces under the command of the National Transition Council to locate Khadafy. (The Libyan group also posted a $1.7 million bounty on the deposed colonel’s head).Plus, Team Obama is putting out some diplomatic fires.

South Africa (whose ruling African National Congress party has long enjoyed Khadafy’s largesse) wants the hapless African Union to lead Libya’s transition. As part of that campaign, Pretoria tried on Wednesday to prevent the release of Libyan assets that were frozen under previous UN sanctions.

But State Department experts say the NTC needs $1.5 billion for immediate humanitarian, nonmilitary, use (Khadafy bounty not included). So US diplomats, in a rare display of leadership, yesterday threatened to force a UN Security Council vote to release the funds. Fearing it would remain alone in stubborn opposition — further staining the record of a country once considered the epitome of world justice — South Africa relented, and the council released the funds.

The episode suggests that the Obama administration — which has long overestimated the virtues of unanimity in a fictional “international community” — is finally learning an important rule of the diplomatic game: Muscling out your opponent trumps consensus.

It also shows that, when it knows where it wants to go, this administration can lead successfully.

But not too often. Under our Goldilocks policy, America must generally forego the “lone leader” position. But will that apply to the next struggle over Libya’s future?

France, Britain, Italy, Turkey and Qatar — not to mention the African Union, the Arab League and other groupings — are crowding the Libyan scene, each positioning itself to help usher in a new era (and get in on oil and other economic opportunities). Even China, long a patron of Khadafy, is looking for ties with the rebels — even as it joins Russia and others in calling for the United Nations to take charge of the transition period.

Yet the UN record in such circumstances is dismal: one failure after another to keep bad actors — whether local extremists or foreign meddlers — in check. Plus, the UN bureaucracy, for now, is reluctant to take over.

Certainly, China & Co. seem to hope that America, plagued by domestic problems, will be eager to withdraw.

This perception — and reality — could prove to be Goldilocks’ undoing. There’s no free lunch: Do we really trust the Europeans, the Arabs and the United Nations with the future of Libya?

Flush with oil, the country can sway world markets. And Libyan arms — including chemical weapons and Scud missiles — remain loose. Unless a credible (read: American) force takes charge, such dangerous toys could end up in the hands of Al Qaeda in the Maghreb or other nefarious groups active in the area. Also, terrorists — or run-of-the-mill thugs — could end up taking over.

We’ll see whether Obama’s “shared leadership” policy can continue to work. For now, though, Libyans celebrate their victory and America can, quietly rejoice. We did good and emerged unscarred.

Who knows, if “leadership from behind” claims a few more scalps, Obama may even decide that real American leadership ain’t all that bad after all.