Warplanes from Libya's UN-recognised government have attacked an oil tanker off the coast near the city of Sirte, wounding at least two people, officials said.

"Our jets warned an unflagged ship off Sirte city, but it ignored the warning," Saqer al-Joroushi, the head of Libya's air force, told the Reuters news agency on Sunday.

"We gave it a chance to evaluate the situation, then our fighting jets attacked the ship because it was unloading fighters and weapons," he added.

"The ship now is on fire. We are in war and we do not accept any security breaches, whether by land, air or sea," Jourushi added.

An oil industry official said the ship was actually a tanker which had been carrying 25,000 tonnes of gas oil. He named the tanker as Anwar Afriqya.

Rida Essa, commander of coastal guards in central Libya, said the tanker had been unloading gas oil for Sirte's power plant when it came under attack. The ship was still on fire, he said.

He said a crew member and a port worker had been wounded.

Libya is still in the midst of a power struggle between two governments fighting for control, with the internationally recognised government operating out of the east since losing control of the capital in August to the rival grouping.

Sirte's power plant on the western outskirts of the city is controlled by forces loyal to the rival government in Tripoli.

The rest of the city has fallen into the hands of Islamic State of Iraq and Levant (ISIL) fighters which have exploited the chaos and security vacuum in Libya four years after the ousting of the late leader Muammar Gaddafi.

Source: Reuters