Two guards and a soldier were killed and four other people were kidnapped early on Saturday in a suspected Daesh attack targeting Libya's Zella oilfield, a security source said.
The death toll was confirmed by the National Oil Company (NOC) which condemned the attack in a statement on Saturday evening.
The attackers struck at an entrance gate to the field, which lies near the town of Zella about 760 km (470 miles) southwest of the capital, Tripoli, before fleeing, according to the source and local residents who asked not to be named.
Daesh claimed responsibility for the attack through its Aamaq news agency later on Saturday.
The Zella field belongs to Zueitina Oil Company, which pumped 19,000 barrels per day on average in the last quarter of 2018 across all its fields.
An engineer told Reuters workers at the field were safe and facilities had not been damaged.
Libya's NOC chief said on Saturday continued instability in the country could cause it to lose 95 percent of oil production.
Daesh has been active in Libya in the turmoil since the overthrow of Muammar Gaddafi in 2011. The militant group took control of the coastal city of Sirte in 2015 but lost it late in 2016 to local forces backed by US air strikes.
In the last two years, the group has targeted three state institutions in Tripoli, home of the UN-backed government of national accord led by Prime Minister Fayez Serraj.
Saturday's assault took place as general Khalifa Haftar's Libyan National Army (LNA), which is allied to a rival administration in eastern Libya, mounts an offensive to control Tripoli.
Reuters