US special forces have seized a commercial tanker that fled with a cargo of oil from a Libyan port controlled by anti-government rebels.

Libyan gunmen demanding regional autonomy and a share of oil wealth managed to load crude onto the ship, which escaped Libya's navy.

The case embarrassed Tripoli's government and prompted parliament to sack the prime minister.

US Navy commandos stormed the Morning Glory tanker as it sat in international waters off Cyprus last night.

They took control of the vessel, which the Pentagon said had been held by three armed Libyans.

The standoff over control of OPEC member Libya's oil illustrates how fragile the North African nation's stability remains since the NATO-backed civil war that led to the fall of Muammar Gaddafi nearly three years ago.

A weak government has been unable to impose its will on former anti-Gaddafi fighters, while militias now use their military muscle to make demands on the state and often target the vital oil sector.

The tanker's seizure by US forces is likely to prevent any more attempted oil sales by the rebels.

In August, rebels took control of three export terminals accounting previously for 700,000 barrels a day of exports.

"Oil is the economy's artery. The government will not allow anyone to fool around with the assets and resources of the Libyan people," the Libyan government said in a statement.

No one was hurt in the tanker raid, which was approved by US President Barack Obama and requested by the Libyan and Cypriot governments, Pentagon Press Secretary John Kirby said.

"The Morning Glory is carrying a cargo of oil owned by the Libyan government National Oil Company. The ship and its cargo were illicitly obtained" from the Libyan port of Es Sider, his statement said.

It was the second time in six months that US forces have become involved in Libya.

A commando team snatched a suspected al-Qaeda suspect off the street as he returned home from prayers in the capital Tripoli in September.

The Cypriot foreign ministry said the vessel was now heading west in the Mediterranean with a US military escort.

It was parked 29km southwest of Cyprus when the operation occurred around midnight Cyprus time.

The Morning Glory had been North Korean-flagged, but the government in Pyongyang on Thursday said it had notified Libya and maritime authorities that it had severed all ties with the ship because of the vessel's contraband cargo.

Abb-Rabbo al-Barassi, self-declared prime minister of the rebel movement, said on Saturday his group was ready to negotiate an end to the port blockade, but the government needed to abandon plans to mount a military offensive.

Libya's parliament head, who has quasi-presidential powers, had given the rebels two weeks to withdraw from the seized ports or face a military operation.

But analysts said it was uncertain whether government troops would be able effectively to confront the heavily armed rebels, made up of soldiers who defected from an oil protection force.