BEIJING — They stood shoulder to shoulder in a sleek, open-air Mercedes, waving at cheering crowds in the North Korean capital, Pyongyang. They watched a propaganda spectacle in a stadium, chatting all the while. And the visitor was greeted with a candy-colored banner hailing him as Grandpa Xi.
Outward signs seemed to suggest a patching-up of the tattered relationship between two allies and neighbors, as North Korea’s leader, Kim Jong-un, played host to President Xi Jinping of China this week. It was the first time a Chinese leader had stepped onto North Korean soil since 2005.
But behind the public bonhomie there was little to suggest that the visit — which lasted barely 24 hours — heralded any real change in the relationship between the North and its one major ally. Both leaders were seeking leverage in their separate disputes with the United States, analysts said, and the meeting seemed hastily arranged to precede Mr. Xi’s expected talks with President Trump in Japan next week.
Mr. Kim, for his part, had a longer-term goal: a good relationship with the United States that would free the North of its economic dependence on China, said John Delury, an associate professor of Chinese studies at Yonsei University in Seoul, South Korea.
“Kim is trying, like the rest of the region, to move North Korea between China and the United States,” Mr. Delury said. “Like everyone else, he is afraid of China’s rise.”
Though the carefully choreographed state media images from Mr. Xi’s visit gave the impression of friendship, its brevity suggested that all was not so smooth, or at least that the two had not had much to talk about, Mr. Delury said.
“It took 14 years for China’s leader to take the two-hour flight to the capital of its closest ally,” he noted. “North Korea has long schemed to survive as an independent entity rather than be China’s sidekick.”
In the last 15 months, Mr. Kim has made a show of independence, shucking the old image of North Korean leaders as ruling a hermit kingdom. Besides Mr. Xi and President Trump, he has met several times with South Korea’s president, whom he hosted in Pyongyang last year, as well as the leaders of Singapore, Vietnam and, most recently, President Vladimir V. Putin of Russia.
The short duration of Mr. Xi’s trip underscored the limits of what he could accomplish with Mr. Kim, said Shi Yinhong, a professor of international relations at Renmin University.
Mr. Shi said the Chinese leader’s first order of business was narrow in scope: to improve the relationship after the acrimony of 2017, when the North, against China’s advice, tested a series of missiles and what it said was a hydrogen bomb. That goal of friendlier ties was probably accomplished with the promise of substantial deliveries of rice to the North, he said.
Drought and poor agricultural yields are raising the specter of starvation in some parts of the North Korean countryside, the United Nations World Food Program said in a recent report. Such humanitarian aid is allowed under the international sanctions regime imposed as punishment for the North’s nuclear arms program.
Mr. Xi’s ability to influence Mr. Kim’s decision making on a potential nuclear deal with the United States is restrained by China’s support for those sanctions, Mr. Shi said. Mr. Kim wants them lifted, but so far China has indicated that it will abide by them, allowing just enough unofficial trade to satisfy a modicum of the North’s energy and other needs.
“The number one game on Kim’s part is the nuclear game with the U.S., and Kim would not be willing to talk much on that except with the Americans,” Mr. Shi said. “So, a very short visit by Xi Jinping.”
Still, there were some signs that Mr. Xi had tried to play the role of mediator on Mr. Kim’s behalf, days before Mr. Xi and Mr. Trump are expected to meet in Osaka, Japan, at a Group of 20 summit conference, where they are likely to discuss their bitter trade conflict.
Before Mr. Xi landed in Pyongyang on Thursday, American officials said they expected him to try to secure Mr. Kim’s promise to take steps on nuclear weapons that might appeal to Mr. Trump, in hopes of gaining leverage for China in the trade dispute.
Mr. Xi signaled as much in a televised session with Mr. Kim on his first afternoon in Pyongyang, when he emphasized the need for the North and the United States to revive talks that broke down in Vietnam in February, when Mr. Kim and Mr. Trump last met.
“The international community hopes that North Korea and the United States can talk and for the talks to get results,” Mr. Xi said, sitting across a table from Mr. Kim.
The discussions in Vietnam fell apart after Mr. Trump presented what the White House called a grand bargain: North Korea would trade all of its nuclear weapons, material and facilities for an end to the American-led sanctions squeezing its economy.
But Mr. Kim said he would only consider reducing his nuclear stockpile gradually, in return for step-by-step easing of the sanctions. (The North has been able to circumvent those sanctions to some degree: The car Mr. Xi and Mr. Kim rode in on Thursday appears to be from what officials have called a fleet of “illicitly obtained Mercedes-Benz limousines.”)
The Chinese have taken heart that Mr. Kim, despite some scattered weapons tests, has not resumed testing on the scale of 2017, said Wu Xinbo, the head of American studies at Fudan University in Shanghai.
The Chinese state-run news agency Xinhua said on Thursday that China still backed a “suspension for suspension” proposal put forward by Foreign Minister Wang Yi several years ago, in which the North would suspend nuclear testing while the United States and South Korea halted joint military exercises. That, more or less, is the current situation.
Both sides “need to have reasonable expectations and refrain from imposing unilateral and unrealistic demands,” Xinhua said.
Thae Yong-ho, a former North Korean diplomat who defected to the South a few years ago, speculated on Thursday that in his meetings with Mr. Xi, Mr. Kim might go along with some version of whatever conciliatory steps the Chinese leader suggested.
“They want to use President Xi Jinping as a mediator at the G-20 in Osaka,” Mr. Thae said at a news conference in Tokyo. “Xi may deliver this new offer directly to President Trump, so now it’s up to President Trump whether he accepts the new proposals.”
But in the long term, Mr. Thae said, Mr. Kim’s offer — whatever it might be — would be designed to buy time, during which the North could keep building nuclear weapons.
Amber Wang contributed research from Beijing