Clashes erupted in central Libya on Saturday between Islamic State fighters and a force loyal to a Tripoli-based faction, a military official and residents said.
It was the first publicly known major confrontation between the two groups since militants loyal to Islamic State, the group that has seized much of Iraq and Syria, established a larger presence in central Libya in recent weeks.
Islamic State, which analysts say is splintered into smaller factions in Libya, has sought to exploit turmoil in the major oil producer where two rival governments and their respective allies fight for power.
Local supporters of the militants executed a group of Egyptian Christians and have claimed attacks on a luxury hotel, foreign missions and police stations in the capital, Tripoli.
On Saturday, Islamic State militants clashed with forces allied to a Tripoli-based government that was established after an armed faction called Libya Dawn seized the capital in August. The internationally recognized government of Prime Minister Abdullah al-Thinni has been forced to operate from the east since then.
The Tripoli-based chief of staff leadership loyal to the rival government said in a statement that two of its soldiers had been killed and seven wounded.
It claimed at least 17 Islamic State fighters had been killed and 13 of their vehicles seized.
Residents confirmed the fighting, some 60 kilometers (40 miles) east of Sirte, a major city where Islamic State have taken over government buildings, a university and a radio station.
Libya Dawn had sent troops from its main power base in Misrata, a western city, to Sirte, but they had mainly kept to the outskirts and avoided a major confrontation with Islamic State fighters in the city center, residents said.
The Tripoli-based chief of staff said Islamic State had tried to encircle several parts east of Sirte and attacked citizens passing though checkpoints.
It denounced Islamic State as Moammar Gaddafi loyalists, a line echoed by the Tripoli parliament, which is backed by some Islamist groups.
The region east of Sirte has been a battlefield since December, when Misrata forces moved in to try seize Libya's two biggest oil ports, Es Sider and Ras Lanuf, which are held by forces loyal to Thinni's government. The oil ports have had to shut down operations because of nearby clashes between the two sides.
Western powers and Libya's neighbors worry that the violent conflict might break up the OPEC producer.