Libyan federalist rebels have agreed to lift a blockade of two oil terminals in the east of the country and allow oil exports.
Two remaining ports are expected to be relinquished under a deal agreed with the government.
A deal to open two oil ports was reached on Sunday between the Libyan government and federalist rebels in the eastern part of the country.
Libya's official news agency Lana said the ports of Zueitina and Hariga, blockaded since July, would be opened immediately.
"The ports... will be handed over to the state with the signature of this agreement," said Justice Minister Salah al-Marghani, who read out a statement referring to the rebels as protesters. "The protesters are banned from returning or obstructing work at the ports," he went on.
The government said two larger ports, Ras Lanouf and al-Sidra, would be released in two to four weeks, after more talks.
The seizure of the ports has been a major embarrassment for the Libyan government, which - along with the transition government before it - has struggled to maintain order since the ouster of late leader Moammar Gadhafi in 2011.
'Goodwill between Libyans'
Rebel leader Ibrahim Jathran confirmed that the siege had ended. "We did this out of goodwill to build trust, have a dialogue and solve all problems between Libyans by peaceful means," he said in a short speech that was broadcast by a rebel television station.
The rebel movement led by Jathran had set up its own self-declared province in the eastern region of Cyrenaica, which has long complained of neglect by Tripoli. They demanded a system to share oil revenues fairly with the central government and a probe into corruption.
The one-page agreement relinquishing the ports is believed to contain government assurances that all charges against the rebels be dropped and that corruption regarding oil revenue be investigated. While there was no apparent mention of a share of oil wealth, a committee to oversee oil exports was said to have been agreed upon.
Libya's Prime Minister Ali Zidan was forced from office by a vote of no confidence after government forces failed to stop the North Korean-flagged tanker Morning Glory from leaving one of the rebel-held ports carrying crude oil. The tanker was later returned to a safe Libyan port after being seized by US Navy Seals.
rc/hc (AFP, Reuters)