By Ayman al-Warfalli

BENGHAZI, Libya, Aug 9 (Reuters) - A car bomb exploded in Derna in eastern Libya on Sunday, killing at least three people and wounding 13 others, medics and residents said, as Islamic State militants pressed an offensive to retake the port city.

It was not immediately clear whether Islamic State was responsible for the car bomb. Accurate information is difficult to obtain in Derna, a remote city controlled by Islamists outside government control.

Islamic State has built up a significant presence in Libya, exploiting a security vacuum as two rival governments battle for power four years after the ousting of Muammar Gaddafi.

But Islamic State was expelled from Derna in June by rival Islamist groups backed up by residents angry over the arrival of foreign fighters and clerics in the city.

Islamic State fighters were trying on Sunday to retake Derna, residents said. The rival Islamist Abu Salim Martyrs Brigade managed to repulse their attack, but fighting with heavy weapons raged late into Sunday night, they said.

In a statement on social media, Islamic State confirmed fighting in an eastern district of Derna, saying there were several dead and wounded. But no further details were immediately available.

The air force of Libya's official government, which has been based in the east of the country since losing control of the capital Tripoli a year ago, conducted an air strike on an area that Islamic State was trying to take, said Abdul-Karim Sabra, a local military spokesman.

The eastern government forces have had a presence near Derna for more than a year but have not tried to take the city.

The government and parliament based in Tripoli are not recognised internationally.

Both Libyan administrations are allied to loose groups of former anti-Gaddafi rebels who have divided up along political, tribal and regional lines. (Reporting by Ayman al-Warfalli; additinal reporting by Ahmed Tolba in Cairo; Writing by Ulf Laessing; Editing by Gareth Jones)

Our Standards: The Thomson Reuters Trust Principles.