Libya's navy has rescued 57 people on a migrant boat off the coast of the North African country, in an operation that involved a clash with armed smugglers.
The attack underscored the fragility of the latest peace push in the North African nation, which has been beset by turmoil since 2011.
An oil company official, who asked not to be named, said masked gunmen had exchanged fire with guards and attacked the firm's headquarters.
The UN decried Saturday "reliable reports" that smugglers and traffickers were impersonating its staff in Libya to target desperate migrants and refugees, and demanded action to hold them to account.
The United Nations has brokered a ceasefire between groups that had been fighting for more than a week in the chaos-ridden oil producer's capital.
Libya is a major departure point in North Africa for migrants crossing the Mediterranean Sea to Europe, mainly from other parts of Africa.
Clashes raged on Monday on the outskirts of Libya's capital Tripoli trapping residents indoors and hampering rescue efforts, as the UN called for talks after more than a week of deadly violence.
Fresh fighting erupted in the Libyan capital on Wednesday after the collapse of a truce, a witness and military source said, after the UN called for calm.
A US air strike killed a suspected Islamic State militant in Libya on Tuesday, the US Africa Command said.
Thursday's attack took place between the towns of Zliten and Khoms on the coastal road leading from Tripoli to the port city of Misrata.
At least four people were killed in a gun attack by suspected militants on a checkpoint east of the Libyan capital Tripoli on Thursday, a local official and a resident said.