SIRTE, Libya (Reuters) - Warplanes from Libya's official government attacked an oil tanker docked outside the city of Sirte on Sunday, wounding three people and setting the ship on fire, officials said.

It was the third confirmed strike by the internationally recognized government on oil tankers, part of a conflict between competing administrations and parliaments allied to armed factions fighting for control of the country four years after the ousting of Moammar Gadhafi.

The recognized premier Abdullah al-Thinni has been working out of the east since losing the capital Tripoli in August last year to a rival faction. Both sides have been attacking each other with warplanes and thanks to loose alliances with former anti-Gadhafi rebels have also been fighting on several fronts on the land.

"Our jets warned an unflagged ship off Sirte city, but it ignored the warning," the eastern air force commander Saqer al-Joroushi told Reuters.

"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," Joroushi added.

Mohamed El Harari, a spokesman for Tripoli-based state oil firm NOC, said the Libyan tanker Anwar Afriqya had been carrying fuel for Sirte's power plant. Another oil industry official said the size of the cargo was 25,000 tons.

A Reuters reporter could see the tanker docked near Sirte's power plant. Two parts of the tanker were still burning.

A port worker said there had been two attacks. First a plane had fired rockets at the tanker's cockpit and crew's cabins, he said. "Then the plane attacked again with guns."

"They attacked after we had discharged the first tank and were readying the second," he said.

Sirte's power plant on the western outskirts is controlled by forces loyal to Tripoli. The rest of the city has fallen into the hands of Islamic State which has exploited a security vacuum.

The eastern government had already attacked in January a Greek-operated tanker docking at Derna, killing two seamen and accusing the shipper of sending weapons. NOC had said the tanker was only carrying heavy fuel oil for a power plant.

Two weeks ago forces loyal to the official government shelled a Turkish ship off the Libyan coast after it was warned not to approach. One crew member was killed in what Turkey described as a "contemptible attack."