HAMBURG, Germany — President Trump on Thursday stepped up efforts to blunt North Korea, warning that the rogue nation could face “some pretty severe” consequences over its latest missile test and huddling for more than an hour with the leaders of Japan and South Korea.

But even as Trump sought to use his proximity to world leaders ahead of the Group of 20 summit to rally allies, the White House faced firm opposition from Russia and China over any retaliatory measures on Pyongyang.

Asked by a reporter at a photo op whether he had lost faith in Beijing, Trump replied: “Never give up.”

But he did not respond to a follow-up question about whether he has been disappointed in China’s inability to constrain North Korean ruler Kim Jong Un.

Earlier in the day, during a news conference in Warsaw before his arrival in Germany, Trump called North Korea’s successful test of an intercontinental ballistic missile “very, very bad behavior.”

“Something will have to be done about it,” he said, though he did not offer details about what responses his administration was considering.

The Trump administration’s effort to forge consensus among members of the U.N. Security Council appears to have hit a wall, given the opposition in Moscow and Beijing to further economic sanctions or potential U.S. military actions against Pyongyang.

New sanctions would have little effect unless backed by China, which is North Korea’s financial lifeline.

Trump had a 75-minute meeting with South Korean President Moon Jae-in and Japanese Prime Minister Shinzo Abe in a bid to put the two U.S. allies on the same page as Washington.

Norio Maruyama, a Japanese government spokesman, told reporters in Hamburg that the conversation was “very vivid” and that the only topic on the agenda was North Korea.

The three leaders agreed that China should do more to rein in North Korea’s “provocative” behavior, Maruyama said. Abe emphasized that “holding dialogue for the sake of dialogue with North Korea is meaningless,” he said.

Maruyama added that the Japanese leader believes that “it would be essential to put pressure on North Korea to make it engage in dialogue seriously.”

Maruyama said the issue of military action was not discussed with any specificity.

“Great trilateral meeting & dinner,” Trump wrote on Twitter, including a photo of him flanked by Moon and Abe. U.S. Secretary of State Rex Tillerson attended the meeting with Trump, along with other U.S. officials.

Their discussion came a day before Trump was to hold his first bilateral meeting with Russian President Vladimir Putin on Friday in Hamburg. Trump is expected to meet with Chinese President Xi Jinping on Saturday.

Defense Secretary Jim Mattis told reporters at the Pentagon on Thursday that the launch of the ICBM does not alone bring the United States closer to war. Mattis described ongoing efforts to pressure North Korea as “purely diplomatically led” with a focus on economic sanctions.

“Diplomacy has not failed,” Mattis said. It is U.S. self-restraint that has prevented “war in the face of provocations,” he said, “but our self-restraint holds, and diplomatic efforts remain underway as we speak.”

Pentagon officials this week have sought to underscore that the ICBM threat posed by North Korea is “nascent” and that Pyongyang has a long way to go in terms of understanding the trajectory of the missiles and reentry before they could hit North America.