Libya’s acting Prime Minister Abdullah Al Thinni said the government had reached a deal with a rebel leader controlling oil ports to hand over the last two terminals and end a blockade that crippled the nation’s petroleum industry. 
“We have successfully reached an agreement to solve the oil crisis . We have received today Ras Lanuf and Es Sider Oil Ports thankfully without the use of force,” Thinni said at Ras Lanuf Terminal in eastern Libya. “I officially declare this is the end of the oil crisis.”
Thinni said the ports had been reclaimed after an agreement with Ibrahim Jathran, whose fighters had seized the terminals almost a year ago to demand more regional autonomy. 
Jathran told reporters that he had handed over the ports as a “goodwill gesture” to the new parliament, which was elected last month.
Taking back the two major eastern oil terminals could make around 500,000 more barrels per day (bpd) of crude available for export, a major breakthrough for the North African state which is a member of the Organisation of Petroleum Exporting Countries (OPEC)and whose coffers have been hit hard by oil revenue losses.
The end of the blockade would also see a final chapter of a crisis that included failed negotiations, threats to bombard rebels and even an attempt by Jathran to dispatch an oil tanker that was later boarded on the high seas by US commandos.
Disputes over Libya’s vast oil resources have been among the many triggers for conflict between rival brigades of former rebels and allied political factions since civil war ended four decades of Muammar Qadhafi’s one-man rule in 2011.
The announcement by Thinni and Jathran appeared to show a more solid agreement to end the oil standoff, but shipments may still face technical delays and past negotiations have been slowed by subsequent political disagreements.
Libya produced around 1.4 million bpd before a wave of protests, strikes and blockades reduced the output to as low as 150,000 bpd. As of Tuesday, national crude output stood at 321,000 bpd.
Jathran’s rebels and their allies, who were all former state oil protection guards before their mutiny, had agreed in April to reopen the two smaller ports, Zueitina and Hariga, and then gradually free up Es Sider and Ras Lanuf.
After that deal, shipments from Zueitina were delayed because of technical damage from the blockade, while Hariga terminal loaded a tanker of crude at the end of last month.
Storage tanks at seized ports are likely full, and loading initial crude will be straightforward, but getting re-supplies from oil fields may be complicated.
Separate protests have also curtailed production at some oilfields, and other groups may still target pipelines and oil facilities to make political or financial demands on a government that struggles to control many parts of the country.
Three years after the fall of Qadhafi in the NATO-backed war on his regime, Libya is far from stable, with brigades of former rebels allied with competing political factions still powerbrokers in the face of a weak state.
Over the last two years, heavily armed militias have seized ministries, attacked the congress, kidnapped diplomats and even briefly abducted a prime minister from his hotel room to pressure the government to meet their demands.
Many of those former rebels are on the government payroll to co-opt them. Often though, their loyalties are stronger to tribe, political faction, region or rebel commander than to the nascent Libyan state.
Jathran’s seizure of three major ports and the taking of a fourth by his allies since last summer clearly illustrated Libya’s fragile democracy and cost Libya billions of dollars in petroleum revenue.
On Wednesday, the rebel leader blamed the former parliament, which was known as the General National Congress or GNC, for delays in handing over the oil ports.
The GNC was paralysed by infighting among Islamist factions including a Muslim Brotherhood-linked Justice and Construction Party, a more liberal-leaning National Forces Alliance movement and scores of independents.