The attack took place near the Iranian town of Saravan, in south east Iran on Saturday. State television said the armed group had crossed the border from Pakistan and ambushed the guards, before fleeing back out of the country.
Hours later 16 rebels were executed, local judicial official Mohammad Marzieh was quoted as saying.
The report provided few other details of the hangings. It did not mention a trial, suggesting the prisoners may already have been convicted and sentenced to death, and their executions moved up after the ambush.
State news agency IRNA said Iranian authorities are now investigating if the attack was by drug smugglers, who operate in the mountainous area, or an opposition group.
More than 100 people have been executed in Iran this year, according to Amnesty International. Death sentences are most commonly handed out for drugs offences.