Gunmen attacked a military parade in the southwest Iranian city of Ahvaz on Saturday, killing 29 people and wounding 57 others, said state television.
Among the dead are women and children, and members of the Revolutionary Guard (IRGC), said the IRNA news agency. Many of the wounded were in critical condition.
Behrad Ghasemi, a local journalist who witnessed the attack, said shots rang out for 10 to 15 minutes and that at least one of the assailants, armed with a Kalashnikov assault rifle, wore the IRGC uniform.
"First we thought it's part of the parade, but after about 10 seconds we realized it was a terrorist attack as bodyguards (of officials) started shooting," he told AFP.
"Everything went haywire and soldiers started running," Ghasemi said.
State television showed images of the immediate aftermath. In it, paramedics could be seen helping someone in military fatigues laying on the ground. Other armed security personnel shouted at each other in front of what appeared to be a viewing stand for the parade.
Local news agencies published photographs of the attack's aftermath, with bloodied troops in dress uniforms helping each other walk away.
Armed forces spokesman Brigadier General Abolfazl Shekarchi said the dead included a young girl and a former serviceman in a wheelchair.
He told state television three attackers were killed at the scene and the fourth died later of his injuries.
Khuzestan deputy governor Ali-Hossein Hosseinzadeh told ISNA that "eight to nine" troops were among those killed, as well as a journalist.
Yahya Rahim Safavi, a senior Revolutionary Guards official, vowed retaliation.
"Enemies should not imagine that they can gain dignity with this sinister move. The Iranian people and the armed forces will respond to this," he was quoted by IRNA as saying.
The attack struck on Ahvaz's Quds, or Jerusalem, Boulevard.
ISIS claimed responsibility for the attack, according to the group's Amaq news agency. The group provided no evidence for the claim.
Saturday's rally was one of many in cities across Iran held to mark the anniversary of the launch of the Iran-Iraq war (1980-88).
Iran's President Hassan Rouhani vowed earlier Saturday to boost his country's ballistic missile capabilities despite Western concerns that were cited by his US counterpart Donald Trump in May when he abandoned the landmark 2015 nuclear deal with Tehran.
"We will never decrease our defensive capabilities... we will increase them day by day," Rouhani said at a separate military parade in the capital Tehran.
"The fact that the missiles anger you shows they are our most effective weapons," he said, referring to the West.
Reports said that Rouhani left the parade after news of the Ahvaz attack broke out.