Libya has seized two foreign-flagged oil tankers and detained their crews for allegedly smuggling fuel after an hours-long gunbattle off the west coast, authorities said.
Oil is Libya's main natural resource, with reserves estimated at 48bn barrels, the largest in Africa.
Libya had an output capacity of about 1.6mn barrels per day before the 2011 armed uprising, but production has since slumped as rival forces battle for control of its oil facilities.
The coastguard spotted the vessels on Thursday night two kilometres off Sidi Said near Zuwara, a town on the central coast, the authorities said.
"The Libyan coastguard boarded the two tankers, one flying the Ukrainian flag, the Ruta, and the other, the Stark, flying the Congolese flag," said General Ayoub Qassem.
"The coastguards had monitored them from afar and waited until Friday morning to act," he told AFP.
Qassem said the oil traffickers were heavily armed and were supported by small boats.
They had put up fierce resistance, but the tankers were eventually seized by the Libyan authorities, "after more than three hours of exchange of fire".
On several occasions, "boats with armed men were returned... and opened fire on the coastguards" using Kalashnikovs and heavy machineguns, he said.
After they were overpowered, the two tankers and their crews were taken back to the capital Tripoli.
Among them were 14 Ukrainians from the Ruta and four Turks and two Georgians who were on the Stark, said Qassem.
Another three crew members from the Stark were in Zuwara, he said, without giving their nationality.
At the time of the seizure, the Ruta had around 3,330 tonnes of oil in its tanks, while the Stark, which can carry 1,236 tonnes, was about to be loaded with fuel when the coastguard arrived.
The crews of the two vessels were taken to Tripoli where they are to face prosecution.
Libya has been wracked by chaos since the 2011 uprising that toppled and killed longtime dictator Muammar Gaddafi, with dozens of armed factions battling for control of the oil-rich country.