Gunmen stormed the town of Ghadwa, opened fire before retreating back into the desert, residents said.
The attack came after nine soldiers were killed on Saturday in an attack claimed by Islamic State on a training camp belonging to the eastern Libyan forces of commander Khalifa Haftar.
Haftar has concentrated his forces in the northwest, where they have been embroiled for the past month in a battle for the capital Tripoli with fighters allied to the divided country’s internationally recognized government.
Islamic State is active in the south to where it retreated after losing its stronghold in the central city of Sirte in December 2016.
Separately, two boats carrying 214 migrants were intercepted by the Libyan coast guard late on Wednesday and taken back to the shore, the U.N. migration agency said.
"As clashes continue in the capital, we are concerned about the return and arbitrary detention of migrants in #Libya," the International Organization for Migration said in a tweet.
IOM spokesman Joel Millman said the 107 people on the first boat included 12 women and 7 children, while the 107 people on the second boat were all men, 92 of them Sudanese, and there had been no reports of missing people or bodies retrieved.
On Wednesday, the independent AlarmPhone website, which provides a hotline for boat people in distress, said it was in touch with a boat with about 150 people on board, who were using their clothes to plug a hole and panicking.
The western Libyan coast is a major departure point for mainly African migrants fleeing conflict and poverty and trying to reach Italy across the Mediterranean Sea with the help of human traffickers.
Smuggling activity had slowed when forces loyal to military commander Khalifa Haftar launched an offensive to take the capital Tripoli, home to Libya’s internationally recognized government.