Rebels in Libya have agreed to re-open two of the four oil terminals they have blockaded since July, according to the country's official news agency, LANA.

The deal between the government and rebels over the Zueitina and Hariga oil ports was announced on Sunday.

Both sides have set a target of two to four weeks for the re-opening of two larger blockaded terminals at Ras Lanouf and Sidra, but full details of the deal are not yet known.

"The ports Zueitina and Hariga will be handed over to the state with the signature of this agreement," said Salah al-Marghani, Libya's justice minister. "The protesters are banned from returning or obstructing work at the ports."

Rebels have blocked the terminals for the past eight months in an attempt to gain greater autonomy from Tripoli and a larger share of the country's oil wealth.

Zueitina and Hariga are the smallest of the four oil ports

The federalist rebels entered into talks with the government after an attempt last month to load crude onto a tanker at one port and force it out to sea failed.

US commandos boarded the vessel in international waters and returned it to Libya in a major blow to the rebels' plan to to sell the oil independently on the global market.

The restarting of Libya's eastern oil ports could increase the country's output to around 150,000 barrels per day. But this would still be far less than the 1.4 million barrels per day it produced before last summer, when Ibrahim Jathran, a former anti-Gaddafi fighter, seized three key ports.

It could also boost Libya's government, which has struggled to control the country since the removal and death of Muammar Gaddafi three nearly years ago.

The eastern oil terminals were a key battleground in the NATO-backed uprising that toppled and killed the veteran dictator in 2011.

Tripoli's authorities denied that there had been any direct talks with the rebels, insisting that negotiations had been conducted through intermediaries from the region's powerful tribes.

It also said the blockade of the export terminals has cost Libya more than $14bn in lost oil revenues.

Negotiations will continue for the reopening of the larger Ras Lanouf and Sidra oil ports.

Source: Agencies