Tens of thousands of Iranians took to the streets on Monday for the funerals of those killed in the weekend’s attack on a military parade amid conflicting claims over who was responsible for the shooting.

Mourners lined the streets of the southwestern city of Ahvaz to pay respects to the 25 people gunned down on Saturday when four armed men opened fire on a military ceremony to commemorate the Iran-Iraq war.

Among those buried was Mohammad Taha Eghdami, a four-year-old boy, who was the youngest victim of the attack. Eight members of Iran’s Revolutionary Guard were also killed in one of the worst attacks suffered by Iran in years. All four gunmen were killed.

The Islamic State (Isil) has claimed responsibility for the shooting but so has an Arab separatist group within Iran, known as the Ahvaz National Resistance.

Ayatollah Ali Khamenei, Iran's supreme leader, said on Monday that the attack was carried out by terrorists paid by Saudi Arabia and the UAE, Iran's regional rivals.

"This cowardly act was done by people who the Americans come to help when they are trapped in Syria and Iraq, and are paid by Saudi Arabia and the UAE," the ayatollah said.

Isil's official news agency, Amaq, released a video purporting to show three of the four gunmen shortly before the attack.