Police use pepper spray on protesters during a demonstration in Hong Kong on Nov. 6. (Tyrone Siu/Reuters)

Thousands of people protested in Hong Kong on Sunday, demanding that China’s central government stay out of a political dispute in the southern Chinese city after Beijing indicated that it would intervene to deter pro-independence advocates. Police used pepper spray and batons to contain some of the demonstrators, arresting two.

The dispute centers on a provocative display of anti-China sentiment by two pro-independence Hong Kong lawmakers at their swearing-in last month.

China’s top legislative panel said Beijing must intervene to deter advocates of independence for Hong Kong, calling their actions a threat to national security. The Standing Committee of China’s rubber-stamp legislature said Beijing could not afford to do nothing in the face of challenges in Hong Kong to China’s authority, the official Xinhua News Agency reported late Saturday.

On Sunday, thousands of people marched in downtown Hong Kong to voice their opposition to China’s plan to step in, saying the move would undermine the former British colony’s considerable autonomy and independent judiciary.

After the protest march, several thousand people gathered in the evening to protest outside Beijing’s liaison office. Police used pepper spray and batons on demonstrators amid some scuffling.

Some protesters wore face masks and hoisted open umbrellas in the air — symbols reminiscent of student-led pro-democracy demonstrations in 2014 that blocked key Hong Kong streets and attracted global attention.

Helmeted police officers with shields stood in several rows, creating a blockade against the protesters. “Open the road! Open the road!” the demonstrators chanted, as police warned them not to charge.

A senior police superintendent said police arrested two men, aged 39 and 57 — one for obstructing police work and the other for failing to show his identity card.

The legislative panel in Beijing said the words and actions of the two Hong Kong lawmakers — Sixtus Leung and Yau Wai-ching — “posed a grave threat to national sovereignty and security,” Xinhua reported.

The statement followed discussions by the committee on issuing an interpretation of an article in Hong Kong’s constitution, known as the Basic Law, that covers oaths taken by lawmakers.

Last month, Leung, 30, and Yau, 25, who are from the radical Youngspiration party, altered their oaths to insert a disparaging Japanese term for China. Displaying a flag that said “Hong Kong is not China,” they vowed to defend the “Hong Kong nation.”

Their oaths were ruled invalid, but attempts at a do-over have resulted in mayhem in the legislature’s weekly sessions.