DUBAI (Reuters) - Iranian President Hassan Rouhani said on Saturday it was no time to build walls between nations and criticized steps towards cancelling world trade agreements, without naming new U.S. President Donald Trump.

Iranian President Hassan Rouhani takes part in a news conference near the United Nations General Assembly in the Manhattan borough of New York, U.S., September 22, 2016. REUTERS/Lucas Jackson/File Photo

Trump on Wednesday ordered the construction of a U.S.-Mexican border wall, a major promise during his election campaign, as part of a package of measures to curb illegal immigration.

“Today is not the time to erect walls between nations. They have forgotten that the Berlin wall fell years ago,” Rouhani said in a speech carried live on Iranian state television.

“To annul world trade accords does not help their economy and does not serve the development and blooming of the world economy,” Rouhani told a tourism conference in Tehran. “This is the day for the world to get closer through trade.”

The protectionist-minded Trump formally withdrew the United States from the Trans-Pacific Partnership trade deal on Monday, fulfilling a campaign pledge to end American involvement in the 2015 pact.

Rouhani, a pragmatist elected in 2013, thawed Iran’s relations with world powers after years of confrontation and engineered its 2015 deal with them under which it curbed its nuclear program in exchange for relief from sanctions.

For Trump’s predecessor Barack Obama, the agreement was a landmark foreign policy achievement but the new president has threatened to annul it or seek a better deal. The other five powers party to the deal have reaffirmed their commitment to it.

Rouhani said earlier this month that Trump could not unilaterally cancel the nuclear deal and that talk of renegotiating it was “meaningless”.

Since sanctions were lifted, Iran has signed major deals with Western firms, particularly with planemakers Airbus AIR.PA and Boeing BA.N.

Rouhani said on Saturday: “Today is the time for peaceful co-existence, not the time to create distance among nations.”

Rouhani made no direct reference to Trump’s order on Friday curbing the entry of refugees into the United States and temporarily barring travelers from Iran and six other Muslim-majority countries. Trump said the moves would help protect Americans from terrorist attacks.