Seven people were shot dead on Friday at a protest against Islamic State in the eastern Libyan city of Derna, residents said.
Demonstrators, angered at the amount of foreign fighters coming in to join the militant group, started marching towards its main base in the coastal settlement when gunmen opened fire into the crowd, several residents told Reuters.
About 30 people were wounded, they added.
Islamic State has thrived in Libya since two rival governments began fighting for control, leaving a security vacuum four years after the overthrow of Muammar Gaddafi.
Western nations have grown particularly alarmed at Islamic State's expansion beyond its strongholds in Iraq and Syria to the increasingly chaotic country just over the Mediterranean.
But the hardline Sunni Muslim movement has also faced substantial local opposition and competition from other militants and Islamist groups vying for power, territory and resources in Libya.
Nine suspected Islamic State members were killed during separate clashes on Friday with other Islamist groups, a source in one of those movements said.
The fighting in Derna - a long-time gathering point for jihadists - first erupted on Tuesday after a leader in the Islamist umbrella group Majlis al-Shura was killed.
Majlis al-Shura responded by declaring holy war against Islamic State.
Islamic State has attacked oilfields and embassies and also claimed the killing of dozens of Egyptian and Ethiopian Christians. It has also attacked both governments, neither of which control Derna.
The official government has been based in the east since losing the capital Tripoli in August to rival group Libya Dawn, which set up its own administration with some Islamist links.