In this Feb. 26, 2011 file photo, a Libyan oil works at a refinery inside the Brega oil complex, in Brega, eastern Libya. Whoever controls oil could decide whether the government grows stronger or the nation fractures. (Hussein Malla/AP)

For nine months, a Libyan militia has occupied massive oil compounds in the desert and along the eastern Mediterranean coast, obstructing this nation’s lifeblood. Last week, after days of negotiations, the armed group struck a deal with the government in Tripoli to open one of the ports.

The group depicted its seizure of the ports and fields as a bid to bring oil revenue and more autonomy to Libya’s long-neglected east. But by crippling oil exports, the militia also exposed how little authority Libya’s U.S.-backed transitional government has over this fragile nation’s land, resources, institutions and — more broadly — its political future.

The ongoing battle for power in Libya is also a battle for oil, the resource that made dictator Moammar Gaddafi, ousted in August 2011, famously wealthy. Whoever controls Libya’s oil could decide whether the country’s weak post-war government grows stronger or the country fractures into militia-governed territories.

Libya’s energy sector accounts for 99 percent of the government’s income, according to U.S. government data, and the siege and other unrest — which caused oil output to fall by more than 83 percent — has jeopardized the government’s ability to pay state salaries and subsidies that it has used to keep its well-armed citizenry in check.

Last month, the United States intervened, deploying Navy SEALs to seize a tanker that the militia had loaded with more than $30 million worth of Libyan crude and steered into international waters to try to sell. As the fiasco unfolded, the country’s elected congress ousted Prime Minister Ali Zeidan for his failure to stop it.

The government’s fragility was further underscored last week when it struck a deal with the militia after failing to follow through on threats to end the oil siege, which it called illegal. After days of negotiations during which the interim prime minister flew to this eastern strip of coastal desert, the militia’s commander, a charismatic 31-year-old former karate champion named Ibrahim Jadhran, agreed to gradually reopen the oil facilities and ports in exchange for concessions from Tripoli.

Neither party has commented on the details of the agreement, which they say is still being hammered out, but Jadhran’s aides say the first likely gesture from the government will include payment to the militia’s fighters, rogue members of the state’s oil facilities protection force. And government officials have said the first of four oil ports could begin exporting as soon as Sunday.

Crumbling eastern cities

Jadhran’s rebel fighters were absorbed by the oil protection force after the revolution. He earned a reputation as a self-styled Robin Hood for Libya’s long-neglected east when he halted oil exports across the region last summer in a bid to force the government to develop the area and become more transparent about oil sales. The move made him one of the most prominent militia leaders in a country where hundreds of armed factions vie for influence.

The shutdown proved popular among easterners and other Libyans who accuse the country’s authorities of failing to alleviate Gaddafi-era discrimination and poverty.

“I supported Jadhran’s closure of the oil ports,” said a western Libyan employee of the Waha Oil Co., which owns much of the oil that Jadhran has controlled.

The employee, who spoke on the condition of anonymity for fear of retaliation, said he cooperated with the Tripoli-based Oil Ministry, as well as a rival militia, in efforts to stop the tanker from leaving port. But he said he initially believed that someone had to confront the interim government’s failures, corruption and lack of transparency. Jadhran did that, he said.

Here among the rutted, unpaved roads of Jadhran’s home town, its low-slung concrete homes battered endlessly by the desert sand, those failures are on stark display. Jadhran’s supporters say they want a bigger share of the nation's resources, accountability in Tripoli and more regional autonomy without seceding from Libya, as their detractors say they aim to do.

“We’re a movement of people who feel that they’re being treated in an unjust way and are trying to reclaim their rights,” said Salem Jadhran, the militia commander’s brother.

Most of Libya’s oil wealth lies in the east. But cities such as Benghazi and Ajdabiya are crumbling from decades of neglect and the political insecurity borne of revolution.

Eastern Libya was the epicenter of opposition to Gaddafi — the region is full of people who claim to have tried to assassinate him, and it was the first territory to reject his rule. (Gaddafi was captured and fatally shot in October 2011.) Residents say his contempt for the region led to its neglect. Many easterners say the interim authorities in Tripoli have failed to right that.

“Seeing how the west and the [Persian] Gulf lived — that luxurious life — that’s what we wanted,” said Salem of himself and his brother, who grew up on this desert plain within miles of some of the country’s biggest oil fields. “It was never anything huge.”

When a member of Libya’s congress allegedly tried to bribe Ibrahim Jadhran to open the ports in September, the militia commander earned more fans for turning down the bribe — and taking checks totaling about $24 million to the local media, stirring public anger at Zeidan.

Jadhran and his followers say their intention in seeking to sell the cargo of oil last month was never to steal the national resource for themselves. Rather, they insist that the income would have been distributed fairly.

A risky precedent

Jadhran’s popularity slipped with the botched oil sale — a move that some of his early supporters said appeared just as secretive and corrupt as the system he claimed to be fighting.

But Jadhran’s seeming victory in extracting concessions from the state and his ability to command a personal visit by the country’s interim prime minister and other top officials bode poorly for Libya's future, analysts say.

If the government concedes to even some of the militia’s demands, other groups that have used force to make their grievances heard could be emboldened, setting a dangerous precedent, said Geoff Porter, who heads the North Africa Risk Consulting firm.

“That will make it very difficult for whatever government comes next to rescind whatever this government granted Jadhran,” he said.

Still, Jadhran’s failure to sell the oil abroad signaled the limits of his power — and perhaps more important, the point at which the United States and other members of the international community would intervene.

“If militias are allowed to get away with sending a tanker loaded with oil out, it undermines the ability of the government of Libya to survive and strengthens the militias,” a Pentagon official, speaking on the condition of anonymity, said of the U.S. raid.

And yet Jadhran’s ability to charter a tanker and load it with oil showed the impotence of Libya’s government, even as Washington and its allies invest millions of dollars to train the country’s militias into a future Libyan military.

It wasn’t the country’s navy — with its tiny fleet of dilapidated ships — that tried to stop the tanker’s departure. Rather, another militia based in the coastal city of Misurata attacked the tanker from tugboats.

Hassan Morajea in Libya and Steven Mufson and Ernesto Londoño in Washington contributed to this report.