An explosion has killed seven Afghan villagers as they tried to pull bodies of dead fighters from the rubble of a village mosque after a night raid by NATO and Afghan troops, officials have said.

Four insurgents and an Afghan soldier were also reported to have been killed in the operation on Sunday.

Night raids have long been a contentious issue between Afghanistan's president, who says he does not want international troops in Afghan villages, and the NATO alliance, which says they are key to capturing Taliban commanders.

Even though Sunday's deaths came hours after the troops left, locals were quick to protest against the US troops that operate in the area.

"Death to America!'' one man shouted as he shook his fist, shown in an Associated Press video.

The villagers displayed the bodies of the dead wrapped in blankets and sheets.

The pre-dawn operation in Sayd Abad district was aimed at capturing a Taliban fighter who had holed up in a village, said Wardak province spokesman Shahidullah Shahid.

The international and Afghan forces captured the fighters but came under attack, sparking a two-hour gunfight during which at least one large blast was heard, he said.

Four insurgents were dead by the time fighting ended.

A few hours later, residents learned the local mosque partly destroyed and started digging through the rubble to uncover bodies.

Live Box 201239113414952721

Shahid says something exploded as they dug, killing seven civilians.

He says the fighters were wearing suicide bomb vests, but it was not immediately clear if that caused the explosion.

A spokesman for international forces in Afghanistan confirmed that four insurgents were killed but did not have any immediate reports of civilian deaths.

"I am aware of reports that indicate there may have been civilians killed, and ISAF and Afghan officials are assessing the situation to determine the facts,'' said Jamie Graybeal, a spokesman for the international military coalition in Afghanistan.

He said that there was no airstrike as part of the operation, but the NATO and Afghan troops did discover a large cache of weapons, which they destroyed on the site, causing a large explosion.

The NATO force said in a statement that an Afghan soldier was also killed in the operation.