(Adds details from Benghazi blast)

By Ahmed Elumami

TRIPOLI, June 22 (Reuters) - Libya's self-declared government in control of the capital Tripoli has launched air strikes on Islamic State fighters in the city of Sirte, officials and witnesses said on Monday.

Officials said the late Sunday night attacks were on a building where fighters had gathered, but gave no details of casualties. Witnesses reported they were accurate and said wounded militants had been taken to hospital.

Fighters allied to Islamic State commanders in Iraq and Syria have been gaining ground in Libya, where two rival governments are battling for control and militants have taken advantage of the security vacuum.

Islamist State has gained ground in cities like Sirte and Derna to the east, challenging local armed groups and government forces alike.

"Warplanes of the air force of the National Salvation government conducted air strikes last night on an internal security building in Sirte," ministry of defence spokesman Mohamed Abdulkafi said by phone, referring to the Tripoli government.

"The strikes targeted a gathering of militants of Islamic State. No figures of casualties from the strikes have been reported so far," he said.

An eyewitness said the bombs hit a former headquarters of former ruler Muammar Gaddafi's security forces in Sirte.

"Many wounded Islamic State militants were taken to the local hospital," the witness said, asking not to be identified to protect their security. Black smoke rose over the city.

A car bomb exploded near Libyan army front lines just west of Benghazi city on Monday, killing at least four soldiers and wounding 20 more as part of an Islamist militant assault, a military source said.

For a year, Benghazi has been the centre of fighting between forces allied with Libya's internationally-recognized government and various militant groups, including Islamic State and a rival alliance of local Islamist forces.

Libya is sliding deeper into internecine fighting between two main armed factions of former rebels and their political allies, who overthrew Gaddafi four years ago and have turned against each other since.

The self-declared National Salvation government has run Tripoli since its forces took over the capital in the summer, forcing the internationally-recognized government of Prime Minister Abdullah al-Thinni to operate from the east.

United Nations peace talks to broker a ceasefire and reach a power-sharing deal between the two factions have been struggling. European powers are pushing for an agreement, worried Libya is becoming a safe haven for militants and for people-smugglers ferrying illegal migrants to Europe.

(Reporting by Ahmed Elumami in Tripoli and Ayman aL-Warfalli in Benghazi; writing by Patrick Markey; editing by Andrew Roche) ((pat.markey@thomsonreuters.com; +21620349006; Reuters Messaging: pat.markey.thomsonreuters.com@reuters.net))