By Ayman al-Warfalli

BENGHAZI, Libya (Reuters) - Five people were killed and 12 wounded during clashes in eastern Libya between forces loyal to its internationally recognised government and Islamist groups, medics said on Sunday.

Fighting broke out on Saturday in the town of Ajdabiya, near the oil port of Brega, and a war plane attacked suspected Islamist positions to the south of the town, residents said.

It was unclear whether the Islamist fighters were affiliated to Islamic State militants, who on Friday attacked a checkpoint manned by troops loyal to the official government outside Ajdabiya, killing five soldiers.

Two more soldiers were killed when the government sent reinforcements, and another 15 have been missing since.

Islamic State has exploited a growing security vacuum in Libya, where two administrations - each with its own government and parliament - are fighting for control four years after the toppling of Muammar Gaddafi.

The official prime minister has been based in the east since a rival group seized the capital Tripoli. He has been working with his cabinet from hotels in the city of Tobruk, about 270 km (167 miles) from Ajdabiya.

Both sides have several former anti-Gaddafi rebel groups fighting for them. After Gaddafi's ouster, the various factions split along political, regional and tribal lines.

Militants loyal to Islamic State, the group which has seized much of Syria and Iraq, has taken over the central city of Sirte, to the west of Ajdabiya.