A US drone strike intended to hit an Islamic State hideout in Afghanistan has killed at least 30 civilians who were resting after harvesting pine nuts.

Forty people were also injured in the attack on Wednesday night which struck farmers and labourers who had just finished their day’s work at the mountainous Wazir Tangi in eastern Nangarhar province, three Afghan officials told Reuters.

“The workers had lit a bonfire and were sitting together when a drone targeted them,” tribal elder Malik Rahat Gul told Reuters by telephone from Wazir Tangi.

Afghanistan’s defence ministry and a senior US official in Kabul confirmed the drone strike, but did not share details of civilian casualties.

“US forces conducted a drone strike against Da’esh [Isis] terrorists in Nangarhar,” said Col Sonny Leggett, a spokesman for US forces in Afghanistan. “We are aware of allegations of the death of non-combatants and are working with local officials to determine the facts.”

About 14,000 US troops are in Afghanistan, training and advising Afghan security forces and conducting counter-insurgency operations against Isis and the Taliban movement.

Haidar Khan, who owns the pine nut fields, said about 150 workers were there for harvesting, with some still missing as well as the confirmed dead and injured.

A survivor of the drone strike said about 200 labourers were sleeping in five tents pitched near the farm when the attack happened.

“Some of us managed to escape, some were injured but many were killed,” said Juma Gul, a resident of north-eastern Kunar province who had travelled along with labourers to harvest and shell pine nuts this week.

Angry residents of Nangarhar province demanded an apology and monetary compensation from the US government.

“Such mistakes cannot be justified. American forces must realise [they] will never win the war by killing innocent civilians,” said Javed Mansur, who lives in Jalalabad city.

Isis fighters first appeared in Afghanistan in 2014 and have since made inroads in the east and north where they are battling the government, US forces and the Taliban.

The exact number of Isis fighters is difficult to calculate because they frequently switch allegiances, but the US military estimates there are about 2,000.

There has been no let-up in assaults by Taliban and Isis as Afghanistan prepares for a presidential election this month.

In a separate incident, at least 20 people died in a suicide truck bomb attack on Thursday carried out by the Taliban in the southern province of Zabul.

Hundreds of civilians have been killed in fighting across Afghanistan after the collapse of US-Taliban peace talks this month. The Taliban has warned Donald Trump will regret his decision to abruptly call off talks that could have led to a political settlement to end the 18-year-old war.

The United Nations says nearly 4,000 civilians were killed or wounded in the first half of the year. That included a big increase in casualties inflicted by government and US-led foreign forces.