BEIJING — The Chinese government’s tone toward the weeks of protests gripping Hong Kong has darkened drastically, with a military spokesman on Wednesday declining to rule out using troops to quell the most significant challenge to Communist Party rule in decades.

The comment came days after protesters vandalized the Chinese government’s liaison office in the semiautonomous southern city, sparking a furious response from Beijing and a torrent of propaganda decrying what it claimed, without proof, to be U.S. instigation behind the unrest.

Chinese Defense Ministry spokesman Wu Qian said it was “intolerable” that protesters appeared to challenge China’s sovereignty over Hong Kong. He noted that the People’s Liberation Army garrison operates under a law that would mobilize troops to restore public order if requested by the Hong Kong government.

When asked by reporters to elaborate, Wu just repeated his remark about the garrison law and did not say more.

The open-ended statement added to a sense of unease falling over Hong Kong this week. The city was stunned Sunday night by an apparent revenge attack by pro-Beijing elements against unarmed anti-government protesters in a suburban train station — an assault that continued for more than an hour before police responded.

The rash of violence and deteriorating political situation have raised concerns of a forceful Chinese response. Hong Kong officials late Tuesday felt compelled to issue a statement dispelling online rumors that the PLA would take over the defense of several Hong Kong government buildings.

On Wednesday morning, the PLA garrison announced on social media that it “recently conducted training on armored vehicle repair and maintenance.”

A PLA general told a senior Pentagon official in June — before protests escalated — that the army would not interfere in Hong Kong’s affairs and that soldiers would remain in their barracks, Reuters reported this month.

Following Wu’s comments, Hu Xijin, editor of China’s highly influential Global Times newspaper, openly contemplated a Chinese military takeover of the city in an essay and said he “really does not want to see” a PLA intervention.

“Once the PLA dominates the situation in Hong Kong and puts down the mobs, then what’s next?” he said. “Hong Kong lacks the appropriate force and mechanism to consolidate the results from a PLA intervention, and we can’t install [Communist] Party committees or subdistrict offices in every corner of Hong Kong.”

One of the conditions for China to intervene forcefully, he added, was if Hong Kong “falls” to the United States and is being used as a “bridgehead” for a U.S. containment strategy against China.

The essay was also posted on the Facebook page of the People’s Daily, the official organ of the Communist Party.

Hu was echoing increasingly shrill Chinese state media this week. After Hong Kong protesters attacked the liaison office Sunday, Chinese state television began fanning outrage on the mainland, repeatedly showing video of the Chinese national emblem defaced with black paint and telling viewers that the city was under siege by American agents.

Even though pro-Beijing gangs attacked the Yuen Long train station Sunday night, China’s state broadcaster showed neighborhood residents lamenting a violent turn in the protest movement as if it had instigated the melee. Chinese social media censors have appeared more relaxed about Hong Kong protest content this week, as nationalist posts lamenting foreign forces “stealing away” China’s “Oriental Pearl” began trending online.

Emotions have run high among Chinese students on campuses worldwide over the Hong Kong protests, as well. Police at Hong Kong’s City University on Tuesday detained a person, apparently a mainland student, who tore down a “Goddess of Democracy” statue and scuffled with fellow students.

At the University of Queensland in Australia, a brawl erupted after Chinese students accosted demonstrators chanting “Free Hong Kong,” then sang along to a speaker blaring the Chinese national anthem.

The university summoned police and issued a statement saying the university’s role was to “enable open, respectful and lawful free speech, including debate about ideas we may not all support or agree with.”

Jean-Pierre Cabestan, a political scientist who specializes in China at Hong Kong Baptist University, played down talk of a forceful move from Beijing.

“Any PLA intervention is exactly the trap in which the central government should refrain from falling into; can you imagine what would happen?” he said.

“To me, it is just an empty threat. The HK police are 30,000 strong and are more than enough to maintain restore order, if instructed to,” he said. “Beijing still needs Hong Kong as a financial center as well as a safe haven for fortunes” of its elite.

Michael Tien, a pro-Beijing lawmaker in Hong Kong, said he “wouldn’t take [comments of] PLA intervention seriously.”

“If Beijing cannot make ‘one country, two systems’ work, it would be a tremendous blow to Xi Jinping’s leadership and administration, and to the whole national policy,” he said, referring to the arrangement under which Hong Kong enjoys relative freedoms compared with mainland China. “And they can kiss Taiwan goodbye forever.”

Tien, who is also one of Hong Kong’s representatives to the National People’s Congress, China’s legislature, said the government has not received a strong warning from Beijing on the possibility of PLA intervention. Beijing instead, he said, has tried to pin the action on “a few hundred extreme troublemakers” rather than Hong Kong society as a whole.

“If anything, the recent events have indicated to them that if they come down too hard on us, it will backfire,” he added. “To maintain ‘one country, two systems,’ they will have to step back a bit.”

Still, the persistent crisis poses a dilemma for Beijing.

The central government probably did not push the extradition bill proposed by Hong Kong Chief Executive Carrie Lam that sparked the protests in the first place.

Yet there is now a growing anti-Beijing flavor to the Hong Kong protests, which Beijing is unhappy about, said Steve Tsang, director of the China Institute at SOAS University of London.

“Its Plan A remains one of requiring or allowing Lam to fix the problems she generated,” he said. “If protests continue, Beijing may eventually resort to taking more direct actions, rendering Lam into a real puppet.”

Critics of Lam, even within the pro-establishment camp of her government, say she has to take bolder political actions and engage with young people who have largely been driving the protest movement.

Zhang Lifan, a historian in Beijing, said the Hong Kong crisis shaped the Communist Party’s stance in its obituary for former premier Li Peng, who died late Monday.

Li was a highly polarizing figure within the party who is best known for his role in dispatching the PLA to crack down another protest — the Tiananmen uprising 30 years ago. State television went to lengths to lionize him on Tuesday in a 10-minute memorial that hailed Li as a hero who would be “immortal.” That disappointed Chinese liberals who hoped for a more balanced reckoning.

“The anti-extradition protest in Hong Kong is pressuring the Communist Party,” Zhang said. “At a moment like this, it cannot be seen as ceding even one step on matters of stability maintenance or historical appraisals.”