President Hassan Rouhani says the US withdrawal from the 2015 nuclear deal with Iran is an insult to the international community, calling on the world to take action against Washington's " illegal" move.

"That the United States is quitting an international treaty unilaterally and without any particular reason is an insult to the world countries and a violation of United Nations Security Council Resolution 2231," Rouhani said on Friday.

Resolution 2231 was adopted by the UN Security Council in July 2015 to endorse the multilateral nuclear agreement, officially called the Joint Comprehensive Plan of Action (JCPOA).

"The whole world has to feel that the approach that the US is adopting is a dangerous approach in international relations which undermines international treaties and countries should not remain silent on this illegal move," he said.

Rouhani made the comments prior to his departure to China, where he is scheduled to take part in the 18th summit of the Shanghai Cooperation Organization (SCO).

The Iranian president said "US unilateralism" is among the issues he would discuss with world leaders at the summit.

Rouhani cited invasion, insecurity, separatism and interference by big powers as the challenges which the Middle East is facing, saying they need to be resolved " politically" through regional summits.

Rouhani also said terrorism and extremism, which threaten the stability and security of the world, especially Central and West Asia, would also be discussed at the summit.

He also touched on the International Quds Day and said rallies held worldwide to mark the event show that the liberation of the holy city from Israel’s occupation has become a global cause.

"The occupying and aggressive Israeli regime can never feel that it is in a safe place," said Rouhani, expressing hope that Palestinians would soon return to their homeland.

The International Quds Day is a legacy of the late founder of the Islamic Republic Imam Khomeini, who designated the day in solidarity with the Palestinians. The annual event falls on the last Friday of the Muslim fasting month of Ramadan.