Save the Children suspended operations across Afghanistan on Wednesday as Islamic State militants terrorised staff trapped inside one of its offices in an hours-long attack, the latest assault on a foreign charity.

Gunmen blasted their way into the British aid group's compound in the eastern city of Jalalabad, killing at least three people and wounding 24.

Save the Children, an AFP reporter at the scene and a security source said the attack was continuing in the early evening, hours after an official claimed it was over.

"Save the Children can confirm that the security incident affecting our office in Jalalabad, Afghanistan is still ongoing," a spokesperson said in a statement.

"In response to this all of our programmes across Afghanistan have been temporarily suspended and our offices are closed."

After blowing up a car outside the charity's compound in Jalalabad, the attackers used a rocket-propelled grenade to storm the complex, in a raid claimed by IS via its propaganda arm Amaq.

Attaullah Khogyani, a spokesman for the Nangarhar provincial governor, said at least three people -- two guards and a civilian - had been killed and 24 wounded. Earlier, he said the attackers were wearing military uniforms.

Up to 50 people including women were rescued from a basement where they had been hiding from attackers, Khogyani said in a statement.

Mohammad Amin, who was inside the compound when the attackers launched the raid at 9:10 am (0440 GMT), told AFP from his hospital bed that he heard "a big blast".

"We ran for cover and I saw a gunman hitting the main gate with an RPG (rocket-propelled grenade) to enter the compound. I jumped out of the window," Amin said.

Afghan TV news channels showed a thick plume of black smoke rising above the compound and what appeared to be at least one vehicle on fire outside the office.

IS has intensified attacks in cities in recent months, targeting mosques and Afghan security forces as it expands beyond its stronghold in the east.

Militant groups rarely claim responsibility for attacks on aid workers.

Charities targeted

Wednesday's assault comes days after Taliban gunmen stormed a luxury hotel in the Afghan capital and killed at least 22 people, mostly foreigners.

Insurgents armed with Kalashnikovs and suicide vests attacked the landmark Intercontinental Hotel, going from room to room searching for foreigners during the more than 12-hour ordeal.

"Attacks directed at civilians or aid organisations are clear violations of international humanitarian law and may amount to war crimes," the UN's mission in Afghanistan tweeted earlier.

The assault on Save the Children, which has operated in Afghanistan since 1976, is the latest violence to hit a foreign aid group in the country, which recorded the second highest number of attacks against aid workers in 2016.

Only South Sudan was more dangerous, according to UK-based research group Humanitarian Outcomes.

The International Committee of the Red Cross announced in October it would "drastically" reduce its presence in Afghanistan after seven employees were killed in attacks last year.

Nangarhar, a restive province bordering Pakistan, is a stronghold for ISIS and also has a significant Taliban presence.

US and Afghan forces have been carrying out ground and air operations against IS fighters in the province.

While Afghan security forces are conducting most of the fighting against IS and Taliban militants, US troops operate alongside them in a training capacity and are frequently on the front lines.

The last major attack in Jalalabad was on December 31 when an explosion at a funeral killed 18 mourners and wounded 13. There was no claim of responsibility.