The Taliban, in a statement on their website, said the men had confessed to “the District court of the Islamic Emirate” that they had robbed travellers on roads in the area.

At midday Thursday, it said, “in the presence of many locals, the penalty ordained by Allah and Sharia (Islamic law) was applied to the highway robbers, a decision welcomed by all Muslims of the area”.

The Taliban ruled the country from 1996 to 2001 and imposed a harsh form of Islamic justice including floggings, amputations and executions.

They were toppled by a US-led invasion in 2001 and have since waged an insurgency against Afghan government forces and foreign troops. Civilians who work for the military are often targeted.