The Islamic State jihadist group launched attacks near key oil facilities in northern Libya on Monday but were repulsed, an army official said.
The jihadists first carried out a suicide car bomb attack on a military checkpoint at the entrance to the town of Al-Sidra, killing two soldiers, said a colonel in the army loyal to the internationally recognised government.
"We were attacked by a convoy of a dozen vehicles belonging to IS," Bashir Boudhfira said. "They then launched an attack on the town of Ras Lanouf via the south but did not manage to enter."
IS has for several weeks been trying to push east from the coastal city of Sirte under its control to reach Libya`s "oil crescent" and the key oil terminals of Al-Sidra and Ras Lanouf.
A Libyan oil official told AFP that a 420,000-barrel oil storage tank in Ras Lanouf caught fire during the clashes.
IS on Twitter announced that its fighters had led an "attack on the Al-Sidra area followed by violent clashes with the enemies of God".
The jihadists have taken advantage of chaos in Libya since the 2011 revolt that ousted and killed longtime dictator Moamer Kadhafi to extend their influence there.
Monday`s attack is the first of its kind since IS seized Kadhafi`s hometown of Sirte in June 2015.
The group said the attack came after it took control of Ben Jawad town, 150 kilometres (90 miles) east of Sirte.
It came as an air force colonel from the city of Misrata east of Tripoli said air strikes were carried out "from morning to nightfall" on jihadist positions.
The officer, who declined to be named, said the strikes focused on targets between Al-Sidra and Ben Jawad.
His comments came amid reports that IS fighters were advancing west of Sirte.Meanwhile, Libya`s national news agency LANA, quoting a military spokesman, reported that a MiG 23 warplane crashed in the region of Abu Hadi, southwest of second city Benghazi, because of a "technical failure in the hydraulic system".
The SITE Intelligence Group reported an IS claim that it shot down the plane.
Oil is Libya`s main natural resource, with a pre-revolt output capacity of about 1.6 million barrels per day, accounting for more than 95 percent of exports and 75 percent of the budget.
But unrest has forced a major slump in production.
The country sits on reserves estimated at 48 billion barrels, the largest in Africa.
Libya has had rival administrations since August 2014, when an Islamist-backed militia alliance overran Tripoli, forcing the government to take refuge in the east.
The United Nations is pressing both sides to accept a power-sharing agreement it hopes will help reverse gains made by IS.
On December 17, under UN guidance, envoys from both sides and a number of independent political figures signed a deal for a unity government.
It calls for a 17-member government, headed by businessman Fayez el-Sarraj as premier, based in Tripoli.
The British ambassador to Libya, Peter Millet, tweeted his concern about the latest developments.
"Deeply concerned by reports of a Daesh (IS) offensive at Sidra & Ras Lanuf. Reinforces the need for Libyans to back Govt of National Accord," he said.