THE REIGN of Libyan dictator Muammar el-Qaddafi seems to be coming to an end after anti-government fighters backed by NATO forces took control of Tripoli.

After months of a military stalemate, the fall of the Libyan capital came with remarkable speed. As this article was being written, Qaddafi had not been captured, and there were still reports of fighting in Tripoli. But while the situation might remain unclear for some time, the main question now is not if, but when. [Update: On the day of publication, heavier fighting broke out in Tripoli, leaving more doubt about how long the pro-Qaddafi side could hold out.]

Masses of Libyans celebrated in Tripoli and around the country as the regime's control of its last stronghold seemed to give way, and they will again when Qaddafi is definitively toppled. Qaddafi is a despised dictator who ruled Libya with an iron fist for more than 40 years, squelching dissent while enriching his family and the small circle around it. His rule continued whether he was seen by the West as an enemy to be demonized--or as a valued ally in the "war on terror."

Hatred of the dictatorship and a thirst for democracy and freedom drove the uprising against Qaddafi when it first arose in February, clearly inspired by the revolutions against tyrants in Tunisia to Libya's west, and Egypt to its east.

But the character of Libya's uprising has been twisted and transformed in the months since.

The rebel forces that took over Tripoli this week operated in collaboration with U.S.-led NATO military forces that have no interest at all in Libyans' desire for freedom. As Independent journalist Patrick Cockburn predicted some months ago, the fall of Tripoli and Qaddafi's regime will be "primarily won by NATO, and not popular revolution."

Last March, the United Nations sanctioned a U.S.-led air campaign in Libya, with the justification that this was the only way to stop Qaddafi's military from committing a massacre against the uprising. But the air war continued and escalated. Meanwhile, Western governments were reshaping the anti-Qaddafi opposition to fit their needs--like ensuring the flow of oil from Libya for one, and even more importantly, creating a reliably pro-Western barrier against the tide of revolution that has swept through the region.

To do this, the U.S. and its European allies backed the most conservative elements among those who claimed to lead the struggle against Qaddafi. A few were already on the CIA payroll--others were former officials of the Qaddafi regime who decided to switch sides.

The new government that will form in place of the Qaddafi regime will be led by these elements. It will be beholden to the U.S. and Europe for its existence--and pliable to their interests.

No one who cares about justice will shed a tear for Muammar el-Qaddafi. He was a tyrant, with the blood of many people on his hands. But no one who opposes imperialism and its crimes can celebrate Qaddafi's downfall in these circumstances.

The new government that will come to power in Libya won't answer to the people of Libya and their desire for democracy and justice. It will answer to imperialism--and that is a blow to the Arab Spring, which this year showed the world the hope of an alternative to oppression, violence and tyranny.

- - - - - - - - - - - - - - - -

THE SPEED with which Tripoli fell--at least in the initial advance into the city--surprised even rebel forces, particularly after hard-fought battles in nearby cities like Zawiyah in the weeks beforehand.

The regime's propaganda campaign--complete with staged demonstrations--about how residents of the capital would rally to the defense of their beloved leader was an obvious fraud. But the rapid advance showed just how little support Qaddafi had among Libyans once the threat of repression no longer hung over their heads.

Nevertheless, the media image from Tripoli over the past days--of lightly armed fighters, riding into the capital in all manner of vehicles, and haphazardly taking over--obscures the real story: The assault on Tripoli was a coordinated military campaign, wholly dependent on NATO forces.

Anti-Qaddafi forces have been reliant on NATO air support since the intervention began in March. In the five months through last Saturday, August 20, Western forces flew 7,459 strike missions in Libya--an average of about 50 per day--against thousands of different targets.

NATO coordination with rebel forces intensified in recent weeks, with fighters on the ground selecting targets and transmitting their locations using equipment provided by Western forces, according to the New York Times. When they need air strikes, "[t]he rebels certainly have our phone number," one anonymous diplomat commented.

During Sunday's advance on Tripoli, the Times reported, "NATO troops continued close air support of the rebels all day, with multiple strikes by alliance aircraft helping clear the road to Tripoli from Zawiyah. Rebel leaders...credited NATO with thwarting an attempt on Sunday by Qaddafi loyalists to reclaim Zawiyah with a flank assault on the city."

Western support hasn't been limited to air power alone, either. Special Forces and intelligence operatives have been in Libya since the intervention in March, training and advising the different rebel groups, and often directing their movements.

- - - - - - - - - - - - - - - -

ALL THIS is a profound contrast to the early stages of the uprising against Qaddafi. Coming in the wake of the downfall of his fellow dictators in Tunisia and Egypt, the revolt in Libya followed the same pattern of mass popular mobilization that won over even units of the military. The initial base of the rebellion was the eastern part of the country nearest Egypt, but support spread. By the end of February, it seemed like the dictator was doomed.

But Qaddafi was able to hold onto power and organize a counter-offensive that relied on military units still loyal to him dealing out savage repression. Once the struggle became primarily a military battle, the rebellion lost its momentum and its advantage--of relying on the mass mobilization of Libyans demanding democracy.

By mid-March, Qaddafi's forces had routed the poorly armed defenders of a string of cities that had joined the uprising--and were threatening Benghazi, the eastern city at the heart of the revolt.

For a time during this counter-offensive, the U.S. and other Western governments seemed willing to stand aside and allow Qaddafi to crush the rebellion, rather than allow another popular revolution against a North African dictator who cooperated with the West. But as the regime's violence became more brazen and deadly--and with doubts circulating about Qaddafi's reliability in cooperating with Western oil companies--opinion shifted in Washington and the capitals of Europe.

The intervention was justified as a "humanitarian" mission to stop bloodshed--with U.S.-led operations supposedly limited to imposing a "no-fly" zone and stopping regime forces that threatened civilians. But the war aims quickly expanded, as antiwar voices like SocialistWorker.org predicted they inevitably would. Barack Obama and other Western leaders were soon talking about continuing the "humanitarian" mission until Qaddafi was overthrown and a new government installed.

Many Libyans welcomed the first attacks as the only way to stop a looming bloodbath in Benghazi. But from the start of the uprising in February, the widespread sentiment was against Western powers dictating the future of Libya. As in other uprisings of the Arab Spring, those who joined the demonstrations expressed their determination that Libyans should make their own revolution. In early March, rebels captured a British Special Forces unit that claimed it wanted to make contact with the opposition--and expelled it from the country.

But once air operations began, Western governments devoted huge resources to shaping the opposition. Figures with a history of collaborating with the U.S. were promoted, as were former officials with the Qaddafi regime who switched sides.

The head of the National Transitional Council (NTC)--already recognized before Qaddafi's fall as the official government of Libya by the U.S. and some 30 other countries--is Mustafa Abdul Jalil, who was Qaddafi's justice minister until he resigned in February at the beginning of the uprising. The U.S. views Abdul Jalil as "cooperative," according to State Department cables revealed by Wikileaks--but then again, he's a familiar face, thanks to the quite-friendly relations between Washington and the Qaddafi regime.

Just as rebel fighters worked closely with NATO forces, the NTC is on good terms with Western diplomats and political figures. As the advance on Tripoli began over the weekend, NTC leaders were in consultations with Jeffrey Feltman, a U.S. assistant secretary of state who traveled to Benghazi for meetings to discuss "a stable, democratic transition."

There's no doubt what someone like Jeffrey Feltman means by "stability." Nevertheless, what happens next isn't set in stone. For example, Patrick Cockburn reported over the weekend that rebels he talked to in the city of Misrata--which saw some of the bloodiest battles of the last five months--say they won't take orders from the NTC.

There may be challenges to the authority of leaders groomed by the West. But the U.S. and its allies will be in a strong position in such conflicts. They pushed the most pro-Western elements of the opposition into the spotlight as "leaders" of the rebellion. Their militaries were indispensable in the battle against the Qaddafi regime. And Western forces now have a presence in Libya--in the air and on the ground--and can intervene in any battles over what comes next.

By contrast, any potential Libyan opposition to the West or to its carefully chosen post-Qaddafi regime is in a weak position. As British socialist Richard Seymour wrote: "There is as yet no political force through which the masses could act independently of the new government, were they even of a mind to do so."

Thus, the U.S. and its allies are all but certain to get a cooperative government in power after Qaddafi--regardless of the aspirations of the masses of Libyans.

- - - - - - - - - - - - - - - -

DON'T EXPECT such considerations to enter into the pious statements of Western political leaders and their enraptured media, though. They'll too busy blustering about how evil Qaddafi is, and how he "got what's coming to him."

During the 1980s, Qaddafi, then an ally of the former USSR in the Cold War, was a favorite scapegoat of U.S. politicians. Ronald Reagan called him the "mad dog of the Middle East" and ordered air strikes against Tripoli and Benghazi in 1986--one bombing run meant to target Qaddafi personally instead killed his adopted 15-month-old daughter.

But by the late 1990s, Qaddafi was making peace with his former enemies. After the September 11 attacks, Libya signed on as an ally of the U.S. in the "war on terror" and backed the invasion of Iraq two years later. In the wake of normalized relations came lucrative business deals with oil giants ExxonMobil, Chevron and other Western companies.

Libya is the only country in North Africa with significant oil deposits--which explains the enthusiasm of nearby European leaders to make friends with Qaddafi during the 2000s. Italy's right-wing Prime Minister Silvio Berlusconi had an especially cozy relationship with the dictator.

Given the chance to intervene militarily in a region that has experienced two successful revolutions since the start of the year, Washington and its allies turned on their ally--and suddenly rediscovered that he was an oppressive dictator.

This record shows the truth about the U.S. government and its alliances around the world. They have nothing to do with principles such as democracy and freedom. Washington was happy to work with Qaddafi when that relationship served its interests.

Now, the U.S. is betting that it can regain some of the ground it lost in the Arab world as a result of the revolutions in Tunisia and Egypt by enabling the overthrow of Qaddafi--and bolstering a new government that can be relied on to protect Western interests. Qaddafi deserved to be overthrown. But the circumstances of his downfall are an advance for imperialism--which means a setback for the struggle to extend democracy and freedom.

This article was edited slightly to reflect developments on Tuesday, August 23.