WASHINGTON — President Trump has shifted his stance on the unrest in Hong Kong in recent days to show greater solidarity with the pro-democracy protesters after coming to view the issue as a point of leverage in trade negotiations with China.

For months, Trump administration officials described the Hong Kong uprising as an internal matter for China, aware of how delicate the issue is for President Xi Jinping and other Communist Party officials. With tensions already high between the two nations and trade talks stalled, the administration chose to tread lightly.

But as the protests have dragged on, advisers to Mr. Trump have succeeded in making the case that wading into the issue could prove necessary — and advantageous — to the United States as it tries to push Beijing to accede to its trade terms.

After previously saying Hong Kong was a “very tough situation” that was up to Chinese leaders to handle, Mr. Trump has more recently called on those leaders to offer a “humane” response and urged Mr. Xi to engage in dialogue with the protesters.

The change in the administration’s tone appeared to be carefully coordinated this week, after Mr. Trump on Sunday issued a warning to China. The words were couched in practical terms centered on a trade deal, not in the language of human rights, but they were nevertheless surprising given Mr. Trump’s earlier passive remarks on Hong Kong.

“I think it would be very hard to deal if they do violence,” Mr. Trump said on Sunday. “I mean, if it’s another Tiananmen Square, it’s — I think it’s a very hard thing to do if there’s violence.”

The next day, Vice President Mike Pence echoed those words in a speech in Detroit. “It will be much harder for us to make a deal if something violent happens in Hong Kong,” he said. “And I want to assure you, our administration will continue to urge Beijing to act in a humanitarian manner and urge China and the demonstrators in Hong Kong to resolve their differences peaceably.”

Secretary of State Mike Pompeo was even more explicit in tying Hong Kong to trade in an interview with Fox News on Monday. He accused China of violating promises it made to Hong Kong and commitments about protecting human rights.

“When we try to negotiate a trade agreement with them,” Mr. Pompeo said, “we’ve tried to put in processes that ensure we have the opportunity to verify because we need to make sure that we don’t suffer from China breaking a promise or have to watch Chinese disinformation about the agreement that’s entered into.”

By conveying the belief that China is straying from its decades-old commitment to preserve Hong Kong’s separate political system, the top American officials are buttressing their argument that a trade treaty with China must have strict enforcement provisions.

They are also sending the message that a violent crackdown in Hong Kong along the lines of the 1989 Tiananmen Square massacre would make China a pariah in the eyes of many Americans and other citizens around the world, rendering it all but impossible to resume trade discussions amid the global backlash.

“Showing support for a peaceful resolution of the situation in Hong Kong could potentially give the U.S. a stronger hand in trade negotiations, under the assumptions that Beijing wants a trade deal badly enough and wants to maintain Hong Kong’s special status in its trade with the U.S.,” said Eswar Prasad, the former head of the International Monetary Fund’s China division. “Both are reasonable assumptions but might be trumped by Beijing’s unwillingness to countenance further protests in Hong Kong that directly challenge Beijing’s authority.”

The Trump administration has already imposed tariffs on $250 billion of Chinese imports and is planning to tax another $300 billion worth. American and Chinese officials have spoken by phone in recent weeks, but no date has been set for a Chinese delegation to visit Washington in September, as had been previously announced. And Mr. Trump has made clear he does not mind keeping the trade war going.

“Unless they’re going to make the right kind of a deal, I’m not ready to make a deal,” he told reporters this week.

Foreign policy officials have grappled in recent weeks with how to get Mr. Trump to take a more forceful stand on Hong Kong. Officials are wary of potentially harsh measures Mr. Xi might take against the protesters. They have become more concerned as videos have emerged of Chinese troops massing across the border in Shenzhen.

Several top aides had urged Mr. Trump to make statements warning the Chinese leadership against using violence. Among them is John R. Bolton, the national security adviser, who views China as a formidable rival. Mr. Trump, on the other hand, said in June that he saw the United States and China as “strategic partners.”

American officials are also cognizant that they must avoid giving the Communist Party ammunition that it can use to reinforce its conspiratorial message that the United States and other Western powers are “black hands” behind the protests.

For weeks, as tensions rose in Hong Kong, Mr. Trump remained passive, suggesting that the uprising was an internal matter for China. That position was not unusual — the president has never made strong statements about protecting human rights in China or elsewhere — and his foreign policy is based mainly on long-held ideas about commerce and transactions. In his two and half years in power, Mr. Trump has been focused on cutting United States expenses abroad and getting more advantageous trade deals.

On Aug. 1, Mr. Trump employed the language used by Chinese Communist Party officials when he said that Hong Kong has had “riots for a long period of time.”

“Somebody said that at some point they’re going to want to stop that,” he added. “But that’s between Hong Kong and that’s between China, because Hong Kong is a part of China.”

Analysts of China said Mr. Xi and other party officials would read those words as a green light to take whatever measures they deemed necessary to suppress the protests.

The language from Mr. Trump was much less assertive than that used by members of Congress from both parties, the State Department and Mr. Bolton. In an interview with Voice of America on Aug. 14, Mr. Bolton said Americans “remember Tiananmen Square” and “the picture of the man standing in front of the line of tanks.” He added, “It would be a big mistake to create a new memory like that in Hong Kong.”

As a trade deal has appeared increasingly remote, Mr. Bolton and other China hawks in the administration have pushed Mr. Trump to move ahead on separate issues that advisers feared might jeopardize the trade talks. That includes the sale of 66 F-16 fighter jets to the self-governing island of Taiwan. The $8 billion deal is the largest or one of the largest arms sales from the United States to Taiwan.

Lawmakers had accused the Trump administration of delaying the sale to avoid upsetting the trade talks. But last week, Mr. Bolton, who advocates greater American support for Taiwan, prodded Mr. Trump to go ahead with the sale. Mr. Pompeo signed a memo approving the deal on Aug. 15, and the administration gave formal notification to Congress this Tuesday.

Yet the administration has failed to take action on what is by far the biggest human rights abuse by China in decades — the detention of one million or more Muslims. Mr. Bolton, Mr. Pompeo and other foreign policy aides have recommended to Mr. Trump that the United States impose sanctions on Chinese officials over the detentions.

Trade advisers such as Treasury Secretary Steven Mnuchin have argued that the sanctions would endanger trade talks. In an interview in June, Mr. Mnuchin would not comment on the detentions of Muslims.

Human rights advocates say they hope the recent appointment of a Uighur-American scholar, Elnigar Iltebir, to the National Security Council will lead to action. Most of the detained Muslims are ethnic Uighurs.

Some analysts are skeptical of the new linkages among trade, human rights and Hong Kong that the administration is pushing. Given Mr. Trump’s vacillations on many issues, “would such a threat be credible to Xi?” said Susan L. Shirk, the chair of the University of California at San Diego’s 21st Century China Center.

Others warn the moves could backfire.

“The U.S. government has to be careful not to do things that could be portrayed as inciting riots,” said Michael Pillsbury, a China expert at the Hudson Institute and an informal adviser to the president. “What the Trump assessment team in Beijing is trying to figure out is the grand strategy. Is Trump trying to overthrow the party, or is it just about trade?”

Hu Xijin, the editor in chief of China’s state-run Global Times newspaper, wrote on Twitter that Mr. Trump’s threats of backing away from a trade deal carried no weight in China.

“As for Washington’s threat to link trade talks with the situation in Hong Kong, what I heard on various occasions is scorn on this idea,” he said. “China is making arrangements on scenario of no deal.”

For his part, Mr. Trump is trying to keep his true intentions murky. Asked on Wednesday if he saw Hong Kong as leverage in trade talks with China, he demurred.

“I don’t view it as leverage or nonleverage,” he said. “I hope it works out in a humane way.”

He added, “And I think that President Xi has the ability to make sure that happens.”