Eight soldiers were killed on Saturday in an attack on a training camp belonging to the eastern Libyan armed forces of Khalifa Haftar in the southern city of Sebha, the head of the local municipality said.
The Islamic State claimed responsibility for the attack.
Hamed al-Khaiyali told Reuters one soldier had been beheaded, the others "slaughtered" or shot.
A source in Haftar's Libyan National Army (LNA) blamed Islamic State and Chadian fighters for the attack, the latter a term used by the LNA for tribesmen opposing Haftar.
Sebha -- like much of the south and its oilfields -- is controlled by the LNA but the force has moved troops north for a month-long offensive on the capital Tripoli, held by the internationally recognised government.
The campaign has not breached the southern defense of the capital.
The LNA faced strong opposition from the Tebu ethnic group during its campaign in the south at the start of the year.
Islamic State militants are also active in southern Libya where is has staged several hit-and-run attacks in recent months. It retreated to the south after losing its stronghold in the central city of Sirte in December 2016.
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now