As Chinese and American officials try to reach a trade deal, Xi Jinping faces a painful, possibly damaging, choice: to try to protect his aura of indomitability or retreat after President Trump accused China of reneging on the terms of a draft agreement and threatened to raise tariffs.

The stakes rose sharply for the Chinese leader this week after Mr. Trump and his chief trade representative, Robert Lighthizer, publicly accused China of backing down on commitments. The sticking point appeared to be a late decision by Mr. Xi to reject American demands that China change laws constraining American businesses.

When Mr. Trump leapt onto Twitter to complain, it was a public rebuke that put Mr. Xi in a tight spot.

Mr. Xi is China’s most powerful leader in decades, and he guards his image as a visionary statesman guiding his country to greatness. But China’s relationship with the United State is its most important, and if ties between the countries are mismanaged, that could damage China’s economy and tarnish Mr. Xi’s authority.

Trade talks that just last week seemed close to fruition have abruptly become a flash point in the rocky relationship. Mr. Xi now faces questions at home over whether he miscalculated Mr. Trump’s resolve, and domestic rumblings could grow if the United States forces Mr. Xi to make concessions or if the talks break down.

“Xi is walking a tightrope,” said Paul Haenle, a former China director on the National Security Council who now runs the Carnegie-Tsinghua Center For Global Policy in Beijing. “He is going to be the one that has to make the most concessions, and that makes all this more difficult for him.”

But geopolitics could help China point to the many ways the sides need each other.

On Thursday, shortly before the trade talks were set to resume, North Korea shot off short-range missiles. The United States has long pressed China, the North’s main political and economic supporter, to help rein in the country’s provocations.

Even if the timing of the launches is a coincidence, they could serve to remind the United States that it needs China’s help to maintain pressure on the North and keep its nuclear program in check.

“I come bearing sincerity, and hope in the current special circumstances to hold a reasoned, frank exchange of views with the U.S. side,” Liu He, China’s chief negotiator in the trade talks said after arriving in Washington, according to Xinhua, China’s official news agency. “China believes that increasing tariffs won’t solve problems, won’t benefit China or the United States, and nor will it benefit the global economy.”

Still, a resolution of the trade war during this week’s talks seems challenging.

China had been willing to protect intellectual property and open its markets to American business, but the Trump administration wanted the agreement to specify that some of those changes be made in Chinese law. For China, any legislative change or policy reversal could be a very public — and potentially humbling — reminder that it gave ground under pressure.

“That would bring back painful memories of the days of national humiliation in our history,” said Wang Yong, the director of the Center for International Political Economy at Peking University. “China has made too many concessions.”

The blaring nature of the Trump administration’s broadsides has sharpened the dilemma that Mr. Xi faces in the negotiations.

“To have Trump doing it so publicly is obviously very, very difficult for Xi Jinping,” said Susan L. Shirk, a professor at the University of California, San Diego, who worked as a deputy assistant secretary of state responsible for China under President Bill Clinton. “It makes it much more difficult for him to make the compromises needed.”

Yet if Mr. Xi holds to a tougher line, Mr. Trump could act on his threat to raise tariffs on $200 billion of Chinese goods as soon Friday. Such a step could shake confidence vital to keeping aloft economic growth in China and around the world, Tu Xinquan, a professor at the University of International Business and Economics in Beijing, said in an interview.

For the party, stable economic growth is fundamental to political legitimacy.

“Everyone may have greater doubts and uncertainty about the future of the Chinese economy, Chinese-U.S. relations or the global economy,” Professor Tu said. “This uncertainty will certainly affect production, investment, and consumption.”

At their first summit meeting just two years ago, Mr. Xi told Mr. Trump that China and the United States had “a thousand reasons” to work well together. But the slow pace of negotiations could tarnish in Mr. Xi’s carefully drawn image at home as a master strategist.

More than two years into the Trump presidency, Chinese officials still appear to struggle to understand the president, his temperament and his negotiating style. American politicians and experts say that Chinese counterparts often fail to grasp how far and fast wariness of China has hardened into hostility.

“There are a lot of voices in Washington that are either sharply or harshly critical of China’s actions in trade, in their military expansionism, in their actions in the South China Sea — fill in the blank,” Senator Chris Coons, a Democrat senator from Delaware, said in an interview in Beijing late last month after meeting Chinese officials.

Mr. Xi’s top economic official, Mr. Liu, a vice premier who leads the Chinese negotiators, could also suffer a setback in his standing if the latest talks falter.

“If, say, Liu He comes back to Beijing empty-handed, and there’s more tirades from Trump on his Twitter account, I think things could get really wild,” Zhang Jian, an associate professor of government at Peking University, said in an interview. “It’s going to spill out of the economic waters.”

Just over a week ago, the outlook for the trade negotiations seemed rosier. Chinese and American officials met in Beijing then for a 10th round of talks aimed at easing trade and economic tensions that spiked after Mr. Trump progressively imposed tariffs on $250 billion worth of goods last year.

Shortly before the talks last week started, the United States Treasury secretary Steven Mnuchin said the negotiations were in their “final laps.” After the talks ended, he said on Twitter that they had been “productive.”

But then Mr. Lighthizer and other Trump administration officials accused Chinese negotiators of trying to reverse concessions they had already made. The air of optimism evaporated.

The Trump officials said that China had retreated from draft agreements calling on its legislature to change laws that have threatened or constricted American trade and business. Two Chinese scholars in Beijing said they were told by well-placed officials that the changes in commitments appeared after Mr. Xi reviewed the draft deal. They spoke on condition of anonymity to discuss internal party matters.

The Chinese government disputed the claims of an underhanded rollback, saying Thursday it was normal for negotiating sides to disagree during talks. “China values trustworthiness and keeps its promises,” Gao Feng, a spokesman for the Ministry of Commerce, said at a briefing. “It has never changed.”

The Chinese have also complained about dealing with a mercurial president they say is apt to turn private disagreements into public brawls.

“Trump’s personality is different, we all know,” said Professor Tu. “He would take something that hasn’t been settled in negotiations and treat it as so-called backsliding by China, or whatever, and then announce it.

“An ordinary president,” he said, “wouldn’t act this way.”

Negotiations with the United States have always been fraught for Chinese officials. Memories of bad blood linger.

In 1999, Zhu Rongji, then the vice premier, went to Washington hoping to reach a breakthrough deal that would open China’s way to joining the World Trade Organization — only to have President Clinton balk.

Mr. Zhu returned to Beijing with his reputation damaged. A month later, the United States accidentally bombed China’s embassy in Belgrade during NATO’s war over Kosovo, igniting bitter protests against Washington across China. It took almost three more years before China joined the W.T.O.

Now Mr. Xi must find a way to satisfy the Trump administration without appearing to give away too much. That could be more difficult if Mr. Trump continues to pelt Mr. Xi with demands on Twitter.

“I think the Chinese side is in an uncomfortable position, as they are reactive instead of controlling the situation as they are accustomed,” said James L. McGregor, a consultant in Shanghai and former chairman of the American Chamber of Commerce in China.

There are grave risks for both sides if the trade talks collapse entirely, many economists say.

Some Chinese academics and business executives have already argued privately and online that Mr. Xi misjudged how far he could push Mr. Trump and promote China as a potential rival to the United States’ dominance.

Mr. Trump, too, would not walk away unscathed. A breakdown in negotiations could weigh down American stock prices, which Mr. Trump invokes as a measure of his policy successes.

Even if the talks in Washington end with handshakes and a new agreement, the past week has laid bare a lack of trust between China and the United States. Tensions over technology competition, spying, Taiwan, the South China Sea and other trouble spots could well up, said Professor Zhang, the Peking University academic.

“The more important thing is not whether there’s a deal or no deal,” he said. “It’s the consensus in the American political class about China as a threat.”