Libya has threatened to bomb a North Korean-flagged tanker if it tries to export oil from a rebel-controlled port east of Tripoli, in a major escalation of a standoff over the country's petroleum wealth.

The rebels in control of Libya's eastern ports are attempting to export oil with the tanker that docked at gunpoint on Saturday.

Mohammed al-Harari, the spokesman for Libya's national oil company, said that the vessel could carry up to 350,000 barrels of oil.

An oil company official, speaking on condition of anonymity because he was not authorised to brief reporters, said armed men forced workers loyal to the government to dock the ship.

Libyan Prime Minister Ali Zeidan said the authorities had told the vessel's captain to leave Libyan territorial waters, but he said gunmen on board were preventing him from leaving.

"All parties must respect Libyan sovereignty. If the ship does not comply, it will be bombed," Zeidan said.

'Tit-for-tat'

Abd-Rabbo al-Barassi, the self-declared prime minister of Libya’s eastern autonomy movement, dismissed the threats from Tripoli.

"We reaffirm that we do not accept any threats towards any tanker or ship that we are dealing with or are contracted with. We are not making threats and we do not want the use of force, however, if anyone attacks us, we will be prepared to defend ourselves," al-Barassi said.

A local television station controlled by protesters showed footage of pro-autonomy rebels holding a lengthy ceremony and slaughtering a camel to celebrate their first oil shipment.

In the distance, a tanker could be seen at what the station said was al-Sidra, one of Libya's biggest export terminals.

It would be the first shipment of exported oil under the self-declared government of Barqa, which calls for greater autonomy in the oil-rich east of the country.

The oil crisis erupted in July, when security guards at key terminals shut them down, accusing the authorities of corruption and demanding a more equitable distribution of oil revenues.

Protesters at the eastern oil ports are demanding a restoration of the autonomy the eastern region was granted in the first decade after Libya's independence in 1951.

Plagued by lawlessness, Libya’s interim government is under mounting pressure to control armed militias and restore order.

Armed groups recently stormed the parliament and briefly arrested Zeidan last year.