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 OPEC 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 a day of crude available for export, a major breakthrough for the Libya, 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 Gaddafi'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.
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 resupplies from oilfields 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.