TEHRAN — President Hassan Rouhani of Iran said on Sunday that a Persian Gulf country allied with the United States was behind the attack on a military parade that killed 25 people and wounded nearly 70 others.

Mr. Rouhani did not identify the country he was blaming for the attack, which was claimed by both the Islamic State and an Arab separatist group. But Bahrain, Saudi Arabia and the United Arab Emirates are close military allies of the United States that view Iran as a foe, particularly because of its support for militant groups across the Middle East.

“All of those small mercenary countries that we see in this region are backed by America,” Mr. Rouhani said. “It is Americans who instigate them and provide them with necessary means to commit these crimes.”

The attack on Saturday, in which militants disguised as soldiers opened fire on an annual military parade in Ahvaz, in the oil-rich southwest, was the deadliest in the country in nearly a decade. The chaos was captured live on state television.