United Nations: US President Donald Trump said that US and Iranian officials met on Tuesday on the sidelines of the UN General Assembly (UNGA).

The unexpected engagement materilaised even as Trump threatened in his UNGA address that he may “annihilate” the Islamic Republic if a deal isn't reached soon to end the nearly seven-month war.

Noting that Iran is waiting to see how the midterm elections play out, Trump said that it ​doesn't make sense for Iran not to make a deal with the United States after the elections.

Trump said the United States will never allow Iran to obtain nuclear weapons.

Trump told reporters that his chief envoys, Steve Witkoff and Jared Kushner, met with the Iranian officials on the sidelines of the annual gathering of world leaders but he offered few details about how the discussions transpired or the substance of the exchange.

“It was a very good meeting,” Trump said. The president later added that the Iranian officials were “not the highest level, but it's something.”

First high-level engagement in months

The engagement comes after months of US-Iran communications languishing following the collapse of a short-lived ceasefire that was brokered in June.

US and Iranian negotiators met separately with Qatari and Pakistani mediators in Doha in early July for indirect talks.

Earlier Tuesday, Secretary of State Marco Rubio said that Trump is open to meeting with Iran's president, Masoud Pezeshkian, while he's in New York for the General Assembly.

“This is a president that will meet with anybody for the most part, because he believes that engaging with people is important if you're going to solve problems,” Rubio said on NBC's “Today” show. “It doesn't mean you're going to end up agreeing with them, but it's important.”

Trump also met on Tuesday with leaders and senior officials from Gulf Cooperation Council nations - Bahrain, Kuwait, Oman, Qatar, Saudi Arabia, and United Arab Emirates - as well as Jordan to discuss the way ahead with the war in Iran.

Trump's address at UNGA

In his address to the General Assembly, Trump made the case that he's shown fortitude while other leaders have equivocated as he defended his decision to start a war with Iran.

But Trump also suggested that he could be at a crossroads in the conflict even as he called on the Islamic Republic to fully reopen the Strait of Hormuz and return to the negotiating table to find a settlement to end the conflict.

“I have a big decision to make,” Trump said. “Will a deal be made with Iran that lets them rebuild and create a far greater country than it ever was before, maybe one of the greatest in the Middle East or even the world. Or do I annihilate the Islamic Republic and do it quickly, never giving them a chance to kill and destroy people and countries again?”

The president's comments came in his wide-ranging address to the international body in which he also celebrated this year's US military operation to oust Venezuelan President Nicolas Maduro from power, a new agreement to expand the US military presence in Greenland, and pushed back against calls for greater regulation of the artificial intelligence industry.

But at the heart of the address was a fulsome defence of the war and pushback on the notion that Iran has shown a measure of resilience.

“The terrorist regime is behaving badly, not because they are strong and confident, but because they are weak and desperate," Trump said.

Most of Iran's delegation walked out of the chamber as Trump railed against the Islamic Republic.