HONG KONG—In a highly symbolic act, mainland Chinese soldiers in black shorts and olive drab T-shirts jogged out of a barracks here to clear streets of bricks, metal bars and other debris left by demonstrators after one of the most violent weeks in five months of pro-democracy protests.

China has garrisoned People’s Liberation Army troops in Hong Kong since the 1997 handover of the former British colony. The soldiers here mostly keep to their barracks and are broadly meant to operate in the city only if the local government asks for assistance.

The presence of the soldiers, even dressed in what amounted to jogging attire, undertaking a brief but politically charged act of removing roadblocks left by Hong Kong’s protesters fueled speculation about the extent of their future role in the semiautonomous city.

The possibility that mainland China might use its military to crush Hong Kong’s protest movement has hung over the demonstrations for months. On Thursday, China’s leader personally commented on the unrest for the first time, exhorting Hong Kong to restore order.

A Hong Kong government spokesman said Saturday the PLA garrison’s help in removing roadblocks was “purely a voluntary community activity.” The Hong Kong government didn’t request assistance from mainland Chinese soldiers, the spokesman said.

The soldiers’ cleanup effort, captured at least in part on local television, took place near a barracks in the Kowloon Tong neighborhood, close to one of the city’s universities, a number of which have been protest hot spots in the past week.

The Chinese Communist Party-run People’s Daily newspaper tweeted about the PLA soldiers joining the cleanup effort, posting three pictures of the event.

The men, who wore their hair military-style short, ran from one cleanup spot to the next, carrying buckets of bricks and other debris, local television showed. A few wore basketball uniforms.

Article 14 of the Basic Law—Hong Kong’s mini-constitution—says military forces stationed by Beijing in the region for defense shouldn’t interfere with local affairs. However, local authorities can ask Beijing for assistance from the garrison for maintaining public order or disaster relief. Hong Kong doesn’t have its own military. Last year, hundreds of Chinese soldiers were deployed in Hong Kong to help with cleanup efforts after a powerful typhoon.

After that operation, the city’s security secretary, John Lee, said the garrison can conduct charitable activities without communicating with the Hong Kong government.

Most people in the city associate China’s army with its deployment at Tiananmen Square in Beijing in 1989.

“I think we could all do without the sight of the PLA on the streets at this sensitive time, even in an unarmed, volunteer capacity,” said David Webb, an activist investor and analyst in Hong Kong. He described their appearance as “a propaganda move” by the Chinese government.

“No doubt it will be portrayed on mainland TV as the People’s heroes undoing the work of the ‘violent terrorists’ and restoring law and order,” Mr. Webb said.

A video circulating on social media Saturday showed a PLA soldier saying their cleanup didn’t have anything to do with the Hong Kong government. “We initiated this. Stopping violence and ending chaos is our responsibility,” he said, highlighting a phrase that Chinese President Xi Jinping has previously used.

At one point, a group of 20 or so soldiers arrived running in formation with brooms and other gear. They scraped off soot, and emptied buckets of debris into dumpsters.

In addition to the PLA, local residents pitched in during the cleanup, according to several students at Baptist University who witnessed the scene. Hong Kong police mostly just watched, the students said.

About a dozen students observed the street-clearing from the university’s Communication and Visual Art building overlooking Baptist University Road, the focus of the cleaning efforts for most of the afternoon.

One student in the building at the time, who asked to be identified only by his surname, Tse, said he saw Chinese soldiers in matching outfits walk out of the PLA barracks Saturday afternoon. Mr. Tse said he was upset to see the roadblocks being cleared away, but couldn’t do anything about it because the students were outnumbered.

Share Your Thoughts What do you think Beijing’s latest move means for the protest movement and the future of Hong Kong? Join the conversation below.

Many students and protesters here went to other universities earlier in the week because there wasn’t much action at Baptist University, he said. Mr. Tse said he stuck around, though, just in case.

Users posting on the messaging app Telegram in the Baptist University’s protester group were upset by Chinese soldiers’ move. “Forget it, we can set up [roadblocks] again,” one user wrote. Protesters are currently discussing plans for more roadblocks, although plans aren’t finalized.

The cleanup effort in Kowloon was one of several that took place across Hong Kong on Saturday, including in areas near the University of Hong Kong that were previously the scene of tense standoffs between protesters and police. On Saturday, local residents near HKU helped clear the area by dismantling the protesters’ barriers and removing bricks from the road.

As Hong Kong authorities struggle to contain antigovernment protests, Chinese paramilitary police have gathered en masse across the border in Shenzhen. Analysts say an armed intervention is unlikely and would evoke memories of the military crackdown on Tiananmen Square 30 years ago. Photo: Dale de la Rey/AFP/Getty Images

The protests were sparked earlier this year by a contentious extradition bill that would have allowed suspects to be sent to mainland China for trial. Though the bill has been withdrawn, the protests have grown into an antigovernment movement opposed to mainland China’s encroachment on the semiautonomous territory.

Some of the ugliest incidents between protesters and police occurred during the most recent workweek, leaving the city’s leaders scrambling for a way to restore order under increasing pressure from Beijing.

A 70-year-old man died Thursday night after being hit in the head with a brick during a clash with antigovernment protesters a day earlier. A 15-year-old boy who was in critical condition as of Wednesday reportedly suffered injuries after appearing to be hit in the head by a tear-gas canister. On Monday, police shot a 21-year-old protester; later, pro-democracy demonstrators set a man who argued with them on fire.

—Rachel Yeo contributed to this article.

Write to John Lyons at john.lyons@wsj.com, Steven Russolillo at steven.russolillo@wsj.com and Eun-Young Jeong at Eun-Young.Jeong@wsj.com