JALALABAD/KABUL (Reuters) - A senior U.S. defense official in Afghanistan’s capital city Kabul on Friday said Islamic State fighters were hiding among pine nut harvesters when a U.S. drone strike in eastern Afghanistan killed at least 32 people.

FILE PHOTO: Men carry a coffin of one of the victims after a drone strike, in Khogyani district of Nangarhar province, Afghanistan September 19, 2019. REUTERS/Parwiz/File Photo

The attack occurred in early hours of Thursday in Wazir Tangi area of Nangarhar province, causing high civilian casualties.

Provincial Afghan officials on Friday said 32 men and children were killed and more than 40 were injured in the strike.

U.S. officials said the drone strike was conducted solely to target IS fighters in a densely forested area that is not inhabited by locals but offers a high yield of pine nuts to villagers residing on the edge of the forest.

“There were IS (fighters) there, but it appears during harvest season the locals cut deals with the IS fighters to act as harvesters,” said a senior U.S. official who is privy to the counter-terrorism operations conducted by American forces in Afghanistan.

“We were not privy to this ‘agreement’ that puts them (IS fighters) amongst other harvesters. We are working through it now with the officials,” he told Reuters.

Senior Afghan officials in Kabul said a probe was being conducted to assess the intelligence failure before planning the drone strike.

Javed, a survivor of the attack recovering in the Nangarhar Regional Hospital, said it was his second night in the forest when a drone struck his temporary shelter.

“Many people were injured,” he said.

President Ashraf Ghani, while speaking at an election rally in Jalalabad, the capital of Nangarhar province, promised measures to prevent civilian casualties in the war against militants.

Afghan forces, often backed by the U.S. military, have intensified ground and air operations against Islamist groups to protect civilians, government buildings, polling stations and a large expatriate population.

Operations such as the latest U.S. drone strike angered locals, who staged small protests against the foreign and Afghan forces.

“We cannot even protest on a large scale because IS or Taliban can target us easily, but the U.S. must admit they made a mistake,” said Rahmatullah Sardar, a dry fruit trader in Jalalabad city.

IS fighters are seen as an even greater threat than the Taliban because of their military capabilities and strategy of targeting civilians. The U.S. military estimates there are about 2,000 IS fighters in Afghanistan.

Separately, the death toll in a Taliban truck bombing that destroyed a hospital in southern Afghanistan has risen to 39, nearly double the previous figure, with 140 wounded, a spokesman for the provincial governor said.

“Only two of those killed were security force members, and the rest of them are civilians, including women, children, patients and visitors,” spokesman Gul Islam Syaal said of Thursday’s attack.

The Taliban said the target of the attack in Qalat, the capital of Zabul province, was a nearby building housing the government’s intelligence department.

The Taliban have been carrying out nearly daily attacks since the collapse of peace talks with the United States this month, in the run-up to elections on Sept. 28 to dissuade people from voting.