Zawiya Oil Refinery Libya
Pipelines and crude oil storage tanks at an oil refinery in Zawia, 55km west of Tripoli, Libya. Reuters

Libyan rebels have agreed to reopen two oil terminals after a deal was reached with the government to partially lift some of the militia-controlled blockades that have brought the country's oil exports to a virtual standstill.

Militiamen seeking greater regional autonomy have agreed with the government to open the oil terminals of Zueitina and Hariga in the east of the country, according to Libya's justice minister, Salah al-Marghani. Two other ports are due to open in the coming weeks.

"There are mediators that have reached an agreement approved by the government to reopen the ports in two stages. Firstly, Zueitina and Hariga ports will reopen. Ras Lanuf and Es Sider ports are going to reopen in two to four weeks. Certainly, there will be other conditions and terms," al-Marghani said.

The partial lifting of the blockade on four terminals, which have been closed for the past eight months, is expected to increase Libya's crude oil exports by about 200,000 barrels per day.

Following the closures of the oil ports by rebels, Libya's oil exports have declined 80% in the past eight months. The country had been producing 1.4 million barrels of oil per day when the rebels seized the ports. The blockade is expected to have cost Libya more than $14bn (€10bn, £8bn) in lost revenues.

Under the terms of the agreement, the government will pay compensation to the rebels, avoid charges against them and drop threatened military action.

"The protesters are banned from returning or obstructing work at the ports," al-Marghani said.

Earlier, the rebels' plans to sell oil independently on the international market failed as US commandos boarded a vessel loaded with crude international waters.

The commandos returned the oil to Libya, and the current round of government-rebel negotiations ensued.