Afghanistan's Defence Ministry and a senior U.S official in Kabul confirmed the drone strike

A US drone strike intended to hit an Islamic State (ISIS) hideout in Afghanistan killed at least 30 civilians resting after a day's labour in the fields, officials said on Thursday.

The attack on Wednesday night also injured 40 people after accidentally targeting farmers and labourers who had just finished collecting pine nuts at 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 U.S official in Kabul confirmed the drone strike, but did not share details of civilian casualties.

"U.S. forces conducted a drone strike against Da'esh (IS) terrorists in Nangarhar," said Colonel Sonny Leggett, a spokesman for U.S. 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 U.S. troops are in Afghanistan, training and advising Afghan security forces and conducting counter-insurgency operations against IS 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 northeastern Kunar province who had travelled along with labourers to harvest and shell pine nuts this week.

Angered by the attack, some residents of Nangarhar province demanded an apology and monetary compensation from the U.S. government.

"Such mistakes cannot be justified. American forces must realise (they) will never win the war by killing innocent civilians," said Javed Mansur, a resident of Jalalabad city.

Scores of local men joined a protest against the attack on Thursday morning as they helped carry the victims' bodies to Jalalabad city and then to the burial site.

Attaullah Khogyani, a spokesman for the provincial governor said the aerial attack was meant to target IS militants who often use farmlands for training and recruitment purposes, but had hit innocent civilians.

Jihadist IS fighters first appeared in Afghanistan in 2014 and have since made inroads in the east and north where they are battling the government, U.S. forces and the Taliban.

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

There was no word from IS on the attack.

There has been no let-up in assaults by Taliban and IS 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 U.S.-Taliban peace talks this month. The Taliban has warned U.S. President 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 U.S.-led foreign forces.