At a ceremony to mark the 40th anniversary of the revolution that transformed Iran into an Islamic republic, President Hassan Rouhani boasted about the country’s military strength and told a large crowd that foreign powers would never dominate Iran again.

“We have not — and will not — ask for permission from anybody for improving our defensive power,” Rouhani said, according to a transcript released by his office. “We will continue this path, and I say this clearly to the people of Iran, that Iran’s military power in the past 40 years, especially in the recent five years, has amazed the entire world.”

Rouhani’s speech Monday marked the anniversary of the date when followers of Ayatollah Ruhollah Khomeini toppled the shah of Iran, allowing the Shiite cleric to take control of the country and set up a theocracy that has endured for four decades. But relations with the wider world have frequently been strained.

Last year, President Trump pulled the United States out of a 2015 deal reached between Iran and six world powers that sought to curtail Tehran’s nuclear program in return for relief from crippling nuclear-related sanctions. Since then, the U.S. government has reimposed a number of economic sanctions on the country, squeezing the nation toward an economic crisis.

Iranian children, some with face paint in the national flag's colors, pose behind a banner depicting the national flag and with signs depicting dogs with the faces of (left to right) President Trump, Saudi King Salman bin Abdulaziz and Israeli Prime Minister Benjamin Netanyahu, as they march during a ceremony celebrating the 40th anniversary of the Islamic revolution in Tehran on Monday. (Atta Kenare/AFP)

Rouhani himself was one of the architects of that deal. Elected in 2013, the Iranian president has been described as a moderate who is open to dialogue with the United States and other Western nations. However, his speech comes amid considerable disillusionment about the economy among Iranians.

A poll conducted in December by the independent organization IranPoll found a large majority (71 percent) of the nation thought that Iran’s economy was bad and getting worse, with shrinking confidence that European nations would continue to abide by the terms of the nuclear agreement.

At anniversary events Monday, Iranian state media showed crowds that appeared to be in the hundreds of thousands. Some Iranians were shown burning U.S. flags and chanting “Death to Israel! Death to America!” — a long-running slogan that has its roots in the immediate aftermath of the 1979 revolution.

Tensions between Tehran and Washington are at the worst they have been for years, in large part due to strains over the nuclear deal, but also due to Iran’s ballistic missile program and its military’s role in a number of conflicts in the Middle East.

In his remarks at Tehran’s Azadi (Freedom) Square, Rouhani framed both as examples of how the Iranian government would not give in to foreign enemies. He said 85 percent of Iran’s military equipment is now built within the country, allowing the nation to achieve a defensive strength that it did not have before.

“In the recent five years, the moment Iran wanted to help the people of Iraq, Syria, Lebanon, Palestine and Yemen, the world saw that the enemies did not achieve any victory against the power of the peoples of the region and Iran’s support,” Rouhani said.

Brig. Gen. Hossein Salami, deputy head of Iran’s Revolutionary Guard Corps, also spoke at the event and praised his country’s willingness to involve itself in foreign battles. “The enemy cannot ask us to leave the region. They must leave the region,” Salami said, according to state media. “We will help any Muslim anywhere in the world.”

The theocratic government established after the 1979 revolution is overseen by Ayatollah Ali Khamenei, who succeeded Khomeini as supreme leader. Last week, Khamenei defended the chants of “Death to America,” saying that they referred only to “death to [President] Trump, [national security adviser] John Bolton and [Secretary of State Mike] Pompeo.”

On Monday, Rouhani praised the democratic legacy of the 1979 revolution and offered his support for a new law that could help improve turnout in Iranian elections.

“Today, we have a true democracy in Iran,” Rouhani said. “Parties, newspapers and the media are free in this country, and all authorities must approach elections with an open mind. The more our mind is open, the readier we will be to prepare the groundwork for the presence of all thoughts, parties and factions.”