ABU DHABI, United Arab Emirates - The Iranian president said yesterday that Iran would retaliate if the United States attacked the country - a tough response to recent comments by Vice President Cheney that Washington would prevent the Islamic republic from dominating the Middle East.

Iranian leader Mahmoud Ahmadinejad also said Iran had agreed for the benefit of the Iraqi people to meet with the United States in Baghdad to discuss security in Iraq.

"They cannot strike Iran," he said, referring to the United States, at a news conference during a two-day visit to the United Arab Emirates. "The Iranian people can protect themselves and retaliate."

His comments came after those Friday by Cheney, who said on an aircraft carrier in the Persian Gulf that the United States and its allies would prevent Iran from acquiring nuclear weapons and dominating the region.

Despite the tense words, the United States and Iran announced Sunday that they had agreed to meet in Baghdad to discuss security and stability in Iraq.

"Both parties have confirmed the talks will take place in Baghdad in the presence of the Iraqi government," Ahmadinejad said yesterday. "We decided we were ready and prepared to do this to support the Iraqi people."

The Iranian president, relatively subdued after the previous night's raucous anti-American rally at a Dubai soccer stadium, repeated his calls for the United States to leave the Persian Gulf region.

Ahmadinejad appeared to be pushing his agenda at a time when the U.S. administration's popularity in the region is at a low point. He said Iran was ready to band together in a gulf-wide security alliance with Washington's traditional regional allies.

He also called for reestablishment of diplomatic relations with Egypt that were broken in 1979, saying it would strengthen regional security and stability.

The U.S. presence in the gulf, Ahmadinejad said, runs counter to the best interests of the Muslim-majority countries on both sides of the oil-rich sea.