Iran's top diplomat has accused the U.S. of propping up undemocratic nations in the Middle East through military support, rather than by popular mandate.

Speaking at the nonprofit Asia Society in New York, Iranian Foreign Minister Mohammad Javad Zarif on Wednesday lauded his country's electoral process and criticized U.S.-backed adversaries that he said proved President Donald Trump's negative depiction of Iran hypocritical. For decades, the U.S. and Iran have found themselves on different sides of the many conflicts in the region, and Zarif's remarks came in response to Trump's heated takedown of Tehran at the U.N. last week.

Related: Trump attacks Iran Deal at U.N. but offers little in return

"Our societies are not that different, we have the same processes. Maybe Trump likes to think of Iran as a dictatorship. It's interesting that all his allies haven't even seen a ballot box in their country and he calls Iran a dictatorship," Zarif said.

"Be it as it may, but this is a process. I don't know what will happen in Iran and I respect that. What is important is that we derive our legitimacy and power from our people, unlike your friends in the region," he added. "We do not derive our legitimacy from the beautiful military equipment of the United States."

One of the countries he was likely referring to was Saudi Arabia, a top U.S. ally in the Middle East—and Iran's biggest rival. The two back opposing militant groups and political parties across the region, including in conflicts like Syria and Yemen. On Wednesday, Saudi Arabia became the last country in the world to allow women to drive, thought they continue to lack basic freedoms. In May, Trump said he signed an arms deal with Saudi Arabia worth up to $350 billion.

That same month, Trump also promised "beautiful military equipment" to Qatar and conducted large military exercises with Jordan, a move that Zarif said at the time could be designed to mask greater U.S. military intervention in neighboring Syria, where the U.S. only recently abandoned support for rebel groups trying to topple President Bashar al-Assad. 

Both Jordan and Qatar, like Saudi Arabia and other U.S. allies in the Persian Gulf, are hereditary monarchies and voting is limited to certain positions.

Like the U.S., Iran holds presidential elections every four years, with the latest seeing President Hassan Rouhani beat his more conservative opponent for a second term. Iran's political and military leadership, however, is overseen by its supreme leader, Ayatollah Ali Khamenei, who was elected by an appointed council of clerics after his predecessor's death in 1989.

The results of Iran's 2009 presidential election drew widespread controversy at home and abroad, with critics claiming incumbent Mahmoud Ahmedinejad actually lost to pro-reform candidate Mir-Hossein Mousavi. Elections in Iran's major Arab ally, Syria, have also been disputed and, though the Iran-backed Shiite Muslim movement Hezbollah has enjoyed political success in Lebanon, presidential elections were delayed for nearly two years due to political infighting.

While Rouhani's victory in May signaled continued support for reform and moderation in Iran, the country's hardliners have gotten a boost since Trump's election. Trump has been a vocal critic of the Iranian government and deeply opposed his predecessor's push for a nuclear treaty, ultimately signed in 2015 by the U.S., Iran, China, France, Germany, Russia and the U.K. Since taking office earlier this year, Trump has pledged to scrap or renegotiate the deal, which gradually lifted Iranian sanctions in exchange for Tehran cutting its nuclear energy production.

Despite the U.N.'s International Atomic Energy Agency and Trump's State Department repeatedly finding Iran to be in compliance with the treaty's terms, Trump took the opportunity to echo and amplify his opposition during his first General Assembly speech. He branded Iran "a corrupt dictatorship behind the false guise of a democracy" and called the Iran Deal "one of the worst and most one-sided transactions the United States ever entered into."

In response, Zarif blasted Trump's "ignorant hate speech," which also met criticism from other world leaders. Iran has insisted it's sticking to the deal, but has threatened to pull out at any point if the U.S. does not live up to it.