Moammar Gadhafi is safe for now, holed up in the Libyan capital surrounded by his followers and militiamen. Rebels hold a large swath of the east and a string of towns nearer the capital. But neither side seems capable of dislodging the other.
The fate of the oil-rich country may depend on how long Gadhafi can maintain the loyalty of troops, mercenaries and tribes that still support him _ and on whether the West decides to take military action to end the standoff.
Nonetheless, analysts caution, it could be months before Libya is rid of its leader of 41 years.
The prospect of a prolonged conflict in the vast and mostly desert nation could ruin Libya _ breaking it up along regional or tribal lines, destroying its oil wealth and turn many of its six million inhabitants into refugees and asylum seekers in neighboring countries or across the Mediterranean in Europe.
Gadhafi has given no sign to date he was willing to step down. Instead, he has vowed to fight on till the end.
"Gadhafi is boxed in. At best, he could hope to be given asylum in Zimbabwe or perhaps Chad," said Marina Ottaway, director of the Middle East program in the Washington-based think tank Carnegie Endowment. "The main question is how long he will have people willing to defend him."
U.S. Secretary of State Hillary Rodham Clinton this week spoke of a Libya embroiled in turmoil for a long time, saying the country "could become a peaceful democracy or it could face protracted civil war."
Foreign intervention could tip the balance. Already, there is talk in the West about enforcing a no-fly zone on Libya to protect rebel-held areas from airstrikes. The United States also has moved warships closer to Libya's Mediterranean coast. And some in the rebel-held areas say they would welcome airstrikes by western nations against pro-Gadhafi forces.
But it could be sometime before the international community reaches a consensus on what to do about Libya militarily. Many analysts believe the U.S. and European nations _ most likely to lead any military action _ may not have the stomach for a new front given their longtime involvement in Afghanistan and Iraq.
Russia is likely to block the U.N. from giving its blessing to a no-fly zone or airstrikes. U.S. Defense Minister Robert Gates this week noted that carrying out strikes is not just a matter of protecting protesters _ you have to take out Libyan air defenses first, a riskier and more expansive act.
But Gadhafi's threats to fight to the end could prompt the West to intervene sooner, said prominent defense analyst Anthony Cordesman of the Center for Strategic and International Studies in Washington.
"The problem is that whenever Gadhafi escalates, the West will escalate back," said Cordesman. "If he executes those threats, he will force the West to become more engaged."
The deadlock was illustrated by this week's battle over the strategic oil port of Brega, captured by the opposition late last month 460 miles (740 kilometers) east of Tripoli. A pro-Gadhafi force briefly succeeded in retaking it in an attack Wednesday morning, but rebel forces captured it back within hours in a fierce battle fought in part on a sandy beach.
Even when the pro-Gadhafi forces sought this week to regain control of a rebel-held city only 30 miles (50 kilometers) west of Tripoli, they failed, driven back by residents armed with weapons looted from local storehouses and backed by army troops siding with the uprising.
The rebels are mainly a ragtag force of volunteers, some of whom have basic military training, joined by mutinous army troops whose own training and discipline is poor.
One reason the conflict could drag on is the Libyan armed forces themselves _ their low professionalism, lack of manpower and tribal rivalries among their ranks. That means neither side has a powerful enough force to overwhelm the other.
Cordesman says the roughly 50,000-strong army is only about the third of the size needed to operate all the equipment available to it. "The inventory is massive."
Part of that inventory has now fallen into rebel hands as the uprising swept over security headquarters and bases in the eastern half of the country. Other equipment still in Gadhafi's hands lies idle with not enough fighters _ or qualified fighters _ to use it.
Gadhafi deliberately weakened the army over the years, fearing that it could overthrow his rule in a coup _ the same way he came to power in 1969. Instead he spent lavishly on arming and training militias that are fiercely loyal to him. He also hired mercenaries from sub-Saharan African nations.
Gadhafi's air force is in no better shape than the army. But it has enough capability to deter the rebel forces in the east from risking the long march to Tripoli along hundreds of miles of Mediterranean coast.
On the other hand, if Gadhafi uses his air force against them, that could bring instant punishment from the West, crippling his air capability with airstrikes against his air bases.
In the end, Gadhafi's fate is entirely in the hands of his defenders in Tripoli _ hundreds of mercenaries and a brigade led by and named after one of his sons, Khamis, says North Africa expert Goerge Joffe.
"As long as they remain loyal to him, he can survive," said Joffe, who lectures at England's Cambridge University.
Money doled out to the mercenaries could eventually run out, given international sanctions slapped on Libya, he said.
But for the mercenaries, it may not only be about money.
"We foreigners don't have much choice, we have to support Gadhafi. It is because of him we are here," said a mercenary from neighboring Mali, who has the rank of a sergeant in the Libyan army.
"If we could find a way of leaving the country, we would," he told The Associated Press by phone on condition of anonymity for fear of reprisals. "The only way Gadhafi is going to go is if someone puts a bullet in his head and I can't imagine that. The soldiers close to him would never let it happen."