In a statement on Saturday, the self-styled Libyan National Army (LNA) said the fighters captured four soldiers in the attack on the town of Zillah, 750 kilometres southwest of the capital, Tripoli.
The LNA, led by renegade military commander Khalifa Haftar, said its troops were able to free four of the captives.
ISIL claimed responsibility for the attack in a statement distributed through its Aamaq news agency.
Reuters news agency, citing a security source and residents, said ISIL fighters struck at the entrance to the Zillah oilfield.
An engineer told Reuters that workers at the field were safe and facilities had not been damaged.
Following the attack on Zillah, the chief of Libya’s National Oil Corporation warned that the continued instability in Libya could make it lose 95 percent of its oil production.
“Unfortunately if the situation will continue like this I’m afraid that maybe 95 percent of production will be lost,” Mustafa Sanalla told reporters in Jeddah ahead of a ministerial panel gathering on Sunday of top OPEC and non-OPEC producers.
The raid on Zillah is the third ISIL attack targeting Haftar’s forces in recent weeks
In May, an ISIL attack on an LNA training camp in the city of Sebha killed at least nine soldiers. Five days later, gunmen killed two civilians in Ghodwa in southern Libya.
The LNA launched an operation in January to purge southern Libya “of terrorist groups and criminals”. After securing support from local tribes, it seized several towns.
Haftar then launched an offensive on April 4 to capture Tripoli from the rival United Nations-recognised Government of National Accord. The campaign has raised fears of further turmoil in the country.
Antonio Guterres, UN secretary-general, has urged all countries to implement an arms embargo against Libya, saying preventing the proliferation of weapons is important to de-escalate the current fighting and restore stability in the country.
He expressed deep concern in a report to the Security Council circulated on Friday that current military operations in Libya are reportedly “being reinforced by the transfer of arms into the country, including by sea”.