In a speech in front of a crowd of thousands in southwestern Iran, the president referred to the destruction of the Askariya mosque's golden dome in Samarra on Wednesday.
Of the US-led forces in Iraq, Ahmadinejad said: "They invade the shrine and bomb there because they oppose God and justice. These passive activities are the acts of a group of defeated Zionists and occupiers who intended to hit our emotions."
Addressing the US, he said: "You have to know that such an act will not save you from the anger of Muslim nations."
The attack on the Askariya shrine, which contains the tombs of two revered imams descended from Prophet Muhammad, was widely condemned in the Arab world on Wednesday.
Jordan's King Abdullah II called it "heinous". Fuad Saniora, Lebanon's prime minister, said it was aimed at "splitting Shia and Sunni Muslims".
While Kuwait's new amir, Shaikh Sabah Al Ahmed Al Sabah, said those who target holy places and kill innocent people are "as far as can be from the teachings of Islam".
Some Muslim leaders and the Lebanese Hizb Allah organisation blamed the United States.
Shaikh Youssef al-Qaradawi, a leader Sunni scholar, said: "We cannot imagine that the Iraqi Sunnis did this. No one benefits from such acts other than the US occupation and the lurking Zionist enemy."
"If responsibility is not in the hands of the Iraqi government, then I consider the responsibility for this event lies with the occupation forces"
Iraqi Shia leader, Muqtada al-Sadr, who cut short a visit to Lebanon to return to Iraq after the blast, said blame must be laid either with the Americans or the Iraqi government.
Al-Sadr added: "If responsibility is not in the hands of the Iraqi government, then I consider the responsibility for this event lies with the occupation forces which should either leave immediately or according to a timetable."
The Iraqi Interior Ministry said four men, one wearing military uniform and three in black, entered the Askariya mosque early on Wednesday and detonated two bombs, one of which collapsed the dome.
No group has claimed responsibility for the attack.