BENGHAZI, Libya (Reuters) - Heavy clashes broke out between Islamic State and army units loyal to the country's official government near the eastern city of Derna on Friday, killing four soldiers, military officials said.

Three soldiers were also wounded during fighting with Islamic State fighters outside Derna, a city east of Benghazi, military officials said.

The conflict is part of chaos gripping Libya, which has fragmented into two governments and parliaments allied to former rebel groups that helped topple Muammar Gaddafi in 2011.

Islamic State, which has exploited a security vacuum in the oil producer, has had a base outside Derna, a traditional jihadi hotspot, since a rival group kicked it out of the coastal city in June.

The air force loyal to the internationally recognized government based in the east also attacked suspected Islamist militant targets in Benghazi, a different battle site, air force spokesman Nasser al-Hassi said.

No casualty figures were available.

Libya's official government has been working out of the east since losing control of Tripoli in August 2014 when an armed group seized the capital and set up a rival administration.

The United Nations has been trying to persuade the warring parties to form a national unity government, but a rival parliament in Tripoli has so far refused to sign a deal.

(Reporting by Ayman al-Warfalli; Writing by Ulf Laessing; Editing by Ken Wills)