By Ahmed Elumami and Ayman al-Warfalli
TRIPOLI/BENGHAZI, Libya (Reuters) - Ten people were killed and almost 40 wounded when Libya's two rival governments clashed with Islamist fighters in two large cities on Wednesday, officials said.
Supporters of Islamic State and other Islamist militant groups have exploited the turmoil in Libya, where two governments and parliaments are fighting for control four years after the ousting of Muammar Gaddafi.
In the eastern city of Benghazi, nine soldiers were killed when fighting the Majlis al-Shura, an umbrella of mostly Islamist groups including Ansar al-Sharia blamed by Washington for the storming of a U.S. diplomatic compound in 2012 which killed the U.S. ambassador.
At least 30 soldiers were wounded, a military spokesman said.
Army forces allied to the internationally recognised government based in the east have been fighting since last year Islamist groups in the port city.
Backed by helicopters, army special forces took back several government buildings in Libya's second-largest city previously held by Majlis al-Shura, said the spokesman.
The army has gained some territory but clashes continue almost daily despite repeated claims by top army commander Khalifa Haftar that his forces were dominating.
In the central city of Sirte, Islamic State fighters fought with forces sent from the western city of Misrata allied to a self-declared government controlling the capital Tripoli, officials and residents said.
Taking advantage of the security vacuum, just as Islamic State did in Syria and Iraq, Islamic State militants had seized Sirte, Gaddafi's home town east of Tripoli, earlier this year.
One member of the Misrata-based Brigade 166 was killed and seven were wounded on Wednesday, Jamal Zubia, a spokesman for the Tripoli-based government, said in a message on social media.
Islamic State said in a Twitter message its fighters had seized a camp of the Misrata forces in southeast Sirte.
The group published pictures purportedly showing its fighters at the camp, seizing several vehicles. A resident said the camp seemed to be in the hands of Islamic State.
Islamic State militants have in recent months claimed responsibility for several attacks including the storming of a Tripoli hotel and the murder of dozens of Egyptian and Ethiopian Christians.
Libya's official government has been based in the east along with the elected parliament since a rival faction seized the capital in August and reinstated a previous assembly.
Islamic State for its part has also built up a presence in Derna, an eastern city known as a jihadi hot spot, and the main eastern city of Benghazi.