Helicopters have attacked camps and strongholds of Islamist militias in eastern Libya as part of a nearly three-week offensive by a renegade general.

The violence has seen at least 18 people killed and sent civilians fleeing in panic, authorities said.

Militiamen responded by firing rocket-propelled grenades and anti-aircraft guns at the attacking troops allied with General Khalifa Hifter.

A former Gaddafi-era army chief, Gen Hifter has rallied support from the country's weakened military, its anti-Islamist politicians, tribes and diplomats, vowing to crush the Islamist militias he blames for Libya's instability.

The clashes started late yesterday and continued overnight, forcing the education ministry to cancel high school exams.

Witnesses said the clashes were near Benghazi University and that gunfire and grenades damaged homes.

In Benghazi's southern districts, citizens set up checkpoints to prevent rival forces from taking shelter as shops closed, according to reports.

Residents have also been unable to leave as the airport has been closed since Gen Hifter's offensive began three weeks ago. Travelling by road has become risky because of the violence.

Mohammed al-Hegazi, a spokesman for Gen Hifter, called on residents to stay away from the fighting. He accused Islamist militias of firing at houses and civilians.

"This is not a football match. This is a war. People must stay away so they won't be used as human shields," he said.

The clashes have killed at least 18 people and wounded at least 81, said Abdullah al-Fitori, a health ministry official said. Hospitals called for blood donations.

Military officials said helicopter gunships flown by pilots loyal to Gen Hifter have been attacking the base of the February 17 militia and camps belonging to the militant group Ansar al-Shariah.

An Ansar al-Shariah spokesman said that its forces have not yet been involved in any fighting, saying February 17 militia was being shelled.

Al Qaida-linked Ansar al-Shariah has been connected to the deadly assault on US Consulate in Benghazi which killed four Americans in 2012, including US ambassador Chris Stevens.

Earlier, Ansar al-Shariah's top leader threatened to fight Gen Hifter and accused him of being an "American traitor" who is supported by Saudi Arabia and United Arab Emirates. He said Gen Hifter wants to replicate Egypt's July military overthrow of president Mohammed Morsi.

Gen Hifter claims to have more than 75% of Benghazi, Libya's second-largest city, under his control. He also says he is getting help from moderate Islamists who are breaking away from their militias and joining his forces. The eastern city was the birthplace of the 2011 uprising that toppled dictator Muammar Gaddafi.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.