A warplane of Libya's internationally recognized government has been shot down while carrying out airstrikes against militant positions in the port city of Benghazi.

Mohammad Ghunem, the spokesman for the government's forces, said on Saturday that “a MiG-21 was shot down by a heat-seeking missile” as it was carrying out airstrikes against positions held by Takfiri terrorists in Libya's second city.

He added that the aircraft, which had been hit by the projectile fired by “terrorist groups”, crashed in Suq al-Hut district of the coastal city, after it successfully conducted an aerial raid against the last bastion of “extremists” in Benghazi’s Mediterranean seafront district of al-Saberi.

Ghunem said the pilot, named as Adel Abdullah Bushisha, survived the crash.

Benghazi, which fell to militant groups in 2014, has ever since witnessed fierce battles between pro-government troops led by General Khalifa Haftar and armed militants, including Takfiri groups such as Daesh and the al-Qaeda-linked Ansar al-Sharia.

Haftar and a faction of loyalist army personnel have taken it upon themselves to fight extremist militants in Libya’s second city. Haftar's self-declared Libyan National Army (LNA) has managed to recapture a large part of Benghazi, but according to LNA, terrorists are still present in the central districts of al-Saberi and Suq al-Hut.

Libya has been dominated by violence since a NATO military intervention followed the 2011 uprising that led to the overthrow and death of long-time dictator Muammar Gaddafi. Rival governments were set up in Tripoli and eastern Libya back in 2014.

In December 2015, however, the two administrations agreed on forming the Government of National Accord (GNA) after months of UN-brokered talks. The presidential council of the GNA arrived in Tripoli in March last year in a bid to restore order to the oil-rich North African country.

Haftar, however, has refused to profess allegiance to the GNA, but his forces have been fighting militants in Benghazi over the past three years. The opponents of Haftar say he is essentially involved in a struggle for power and is undermining the country.