Libyan air force jets have bombed a Greek-operated oil tanker chartered by Libya's national oil company, killing two crew members.
A Libyan military spokesman told the BBC that the ship's movements at the port of Derna had aroused suspicion.
The oil company rejected this, saying the ship was delivering fuel to industrial facilities there and the authorities had been kept informed.
Derna has been controlled by Islamist militants for the past two years.
The Libyan military attacked the port several times last year in an attempt to weaken militant groups there.
The military spokesman, Colonel Ahmed Mesmari, said the tanker had been targeted because it had failed to submit to an inspection before entering the port.
He said the vessel was supposed to dock at a power plant in Derna but instead "took a different route", entering a "military zone".
"We asked the ship to stop, but instead it turned off all its lights and would not respond so we were obliged to strike it.
"We bombed it twice," he said.
Libya's National Oil Corporation said the tanker had picked up 13,000 tonnes of heavy fuel oil in Brega, a port south of Libya's second city, Benghazi, which it was due to deliver to a power plant and water purification facility in Derna.
It said the vessel was attacked before it could enter the port to unload its cargo.
There were 26 crew members on board the ship, Araevo, including nationals from the Philippines, Greece and Romania.
Two were injured in Sunday's attack, in addition to those killed.
The Liberian-flagged tanker is operated by an Athens-based shipping company, Aegean Shipping Enterprises Company.
The company said there was no leakage of oil and it was assessing the damage.
Col Mesmari told Reuters the vessel had been bringing Islamist fighters to Derna.
"We had warned any ship not to dock at the port without prior permission," he was quoted as saying.
The National Oil Corporation did not comment on the allegation but said the bombing of the tanker would have a "very negative" impact on oil shipping from Libyan ports.
It said it remained neutral in the conflict in Libya and the incident would hinder its ability to maintain supplies within the local market.
Libya has been in chaos since its long-time leader, Colonel Muammar Gaddafi, was overthrown with Western military help in 2011.
Numerous militias govern their own patches of territory, with successive governments struggling to exercise control.
The competition for power and resources has led to frequent fighting and battles to control facilities, including ports, linked to Libya's oil industry.
The internationally recognised government is based in Tobruk, near the Egyptian border, having been expelled from the capital, Tripoli, by militias in 2014.
A rival militia-backed administration now controls the capital while Benghazi is largely in the hands of Islamist fighters.