TEHRAN — The Iranian authorities executed 16 Sunni insurgents on Saturday, Iranian media reported, in retaliation for an attack a day earlier that killed 14 guards on the volatile southeastern border with Pakistan.

The 14 soldiers, most of them conscripts, were killed at dusk on Friday at a border post near the city of Saravan when a group of armed men crossing the border gunned them down using automatic weapons, the semiofficial Iranian Students’ News Agency reported on Saturday. Seven other soldiers were wounded, the news agency said, and some local reports said the attackers also took three guards hostage.

In retaliation, 16 “bandits linked to groups against the system” were hanged early Saturday, Mohammad Marzieh, the chief prosecutor in Zahedan, the capital of Sistan and Baluchestan Province, told the semiofficial Fars news agency. It is unclear whether the executed men were already in custody in the province or were rounded up, but they were not believed to be connected to the border attack.

“We had issued warnings previously that bandits and anti-Iran group members who commit acts causing damage to innocent people or security and military personnel will face reciprocal action by us,” Mr. Marzieh said. “This morning, in retaliation for the martyrdom of border guards at the town of Saravan, we hanged 16 members of these anti-Iran groups. The judiciary will absolutely not tolerate such actions by these groups.”