Iranian President Hassan Rouhani said on Monday stability could not be achieved in the Middle East without Tehran's help, responding to criticism from US President Donald Trump who is visiting the region.

Trump called for a US alliance with Muslim countries aimed at fighting "terrorism", singling out Iran as a major source of funding and support for armed groups in the Arab world.

Rouhani, a pragmatist who won last week's presidential election, hit back hard by dismissing the summit as a "ceremonial [event] that had no political value and will bear no results".

"Who can say regional stability can be restored without Iran? Who can say the region will experience total stability without Iran?" he said at a news conference.

READ MORE: How Iran views its role in the Middle East

At a weekend summit in Riyadh, Trump accused Iran of funding and arming "terrorists, militias and other extremist groups" in Iraq, Yemen, Lebanon and backing President Bashar al-Assad in Syria's civil war.

Rouhani, who fronted Tehran's deal with six major powers in 2015 to curb Iran's nuclear programme in return for the lifting of sanctions, said the US administration lacked knowledge about the Middle East.

"Americans resorted to many different methods against Iran but failed in all ... We are waiting for the new US administration to find stability and continuity in its policies," Rouhani said.

"The problem is that the Americans do not know our region and those who advise US officials are misleading them."

Rouhani said Iran was the vital force behind the fight against the Islamic State of Iraq and the Levant (ISIL) and repeated Iran's official stance that the United States and Saudi Arabia are funding "terrorism" in the Middle East.

"Who fought against the terrorists? It was Iran, Syria, Hezbollah and Russia. But who funded the terrorists? Those who fund terrorists cannot claim they are fighting against them," he said.

Tehran and Riyadh are involved in proxy wars across the region, backing opposite sides in Syria, Yemen, Iraq and Lebanon.

Fragile diplomacy

Already fragile diplomatic and trade ties between Sunni Saudi Arabia and Shia-dominated Iran were severed last year, after Saudi Arabia executed a Shia cleric and, as a result, protesters ransacked the Saudi embassy in Iran.

"Buying arms or building weapons won't make a country powerful. Military power is only a part of strength and we are fully aware of that. But the foundation of power is national strength and this only happens through elections," Rouhani said.

"Maybe it will help if Saudi leaders let their people decide over their country's fate by casting their vote ... It will make them [rulers] stronger."

He said Iran welcomed better relations with its regional neighbours and pledged to fulfill his campaign promises of opening Iran to the world and delivering freedoms to the Iranian people.

"The Iranian people voted for moderation as they know a prosperous economy and jobs can only happen through investment, and investment through freedom and interaction with the world," he said.

READ MORE: Rouhani - Iran ready to promote relations with the world

Rouhani's efforts to open up Iran to less hostile relations with the West still have to be couched in the rhetoric of anti-Americanism that has been a pillar of Iranian rule since the Islamic Revolution of 1979. Iran's most powerful authority - Ayatollah Ali Khamenei - has ruled out normalisation of ties with the United States.

Iran's economy has slowly recovered since the lifting of sanctions last year but deals with Western investors are few and far between as foreign investors are cautious about trading with or investing in Iran, fearing penalties from remaining unilateral US sanctions.

Washington last week imposed new sanctions on Iran over its ballistic missile programme.

"The Iranian nation has decided to be powerful. Our missiles are for peace and for defence ... American officials should know that whenever we need to technically test a missile, we will do so and will not wait for their permission," Rouhani said.

"America's dream on ending Iran's missile programme will never come true."