UNITED NATIONS (Reuters) - United Nations Secretary-General Antonio Guterres appealed on Tuesday for statesmanship to avoid war with North Korea and criticized world leaders who stoke resentment over refugees for political gain, two digs at U.S. President Donald Trump.

In his first address to the annual 193-member U.N. General Assembly since taking office in January, Guterres said the crisis over North Korea’s nuclear and ballistic missile programme must be solved through a political process.

“This is the time for statesmanship,” said the former prime minister of Portugal. “We must not sleepwalk our way into war.”

Trump has warned North Korea that military action was an option for the United States as Pyongyang has carried out a series of tests towards developing the ability to target the United States with a nuclear-tipped missile.

The U.N. Security Council has unanimously imposed nine rounds of sanctions on North Korea since 2006 and Guterres appealed for the 15-member body to maintain its unity on North Korea.

Guterres, a former head of the U.N. refugee agency, also spoke of being “pained to see the way refugees and migrants have been stereotyped and scapegoated - and to see political figures stoke resentment in search of electoral gain.”

United Nations Secretary General Antonio Guterres addresses the 72nd United Nations General Assembly at U.N. headquarters in New York, U.S., September 19, 2017. REUTERS/Lucas Jackson

Shortly after taking office in January, Trump moved to put a 120-day halt on the U.S. refugee programme, bar Syrian refugees indefinitely and impose a 90-day suspension on people from six predominantly Muslim countries. He says the move is needed to prevent terrorist attacks.

“I myself am a migrant, as many of you are. But no-one expected me to risk my life on a leaky boat or cross a desert in the back of a truck to find employment outside my country of birth,” he said. “Safe migration cannot be limited to the global elite.”

Guterres also warned of the dangers of climate change and urged world leaders to implement the 2015 Paris climate agreement to reduce emissions “with ever greater ambition.”

Trump, who campaigned in the 2016 presidential election on an “America First” platform, has said the United States would withdraw from the accord. Trump said it would harm U.S. industries, cost U.S. jobs, weaken American national sovereignty and put the country at a permanent disadvantage to other nations.

“It is high time to get off the path of suicidal emissions. We know enough today to act. The science is unassailable,” Guterres said.

On counterterrorism, Guterres said he plans to convene next year the first gathering of heads of counterterrorism agencies of U.N. member states to forge a new international counterterrorism partnership.