BEIJING -- China’s top legislature effectively barred two democratically elected separatist lawmakers from taking office in Hong Kong with a ruling Monday on the city’s constitution, an intervention into a local political dispute that’s likely to spark further turmoil in the southern Chinese city.

The National People’s Congress Standing Committee in Beijing said it adopted an interpretation of an article in Hong Kong’s mini-constitution on oath-taking. It acted after a provocative display of anti-China sentiment by two newly elected pro-independence Hong Kong lawmakers at their swearing-in ceremony last month.

Thousands of people protested in Hong Kong on Sunday, demanding that China’s central government stay out of the political dispute, saying the move would undermine the city’s considerable autonomy and independent judiciary. Police used pepper spray and batons to contain some of the demonstrators, arresting two.

Get Breaking News Delivered to Your Inbox

In issuing the interpretation, the National People’s Congress Standing Committee said talk of independence for Hong Kong is intended to “divide the country” and severely harms the country’s unity, territorial sovereignty and national security.

The interpretation says that those who advocate for independence for Hong Kong are not only disqualified from election and from assuming posts as lawmakers but should also be investigated for their legal obligations.

Lee Cheuk-yan, a former pro-democracy lawmaker who was among the protesters, said Hong Kong residents were concerned that Beijing was encroaching on their relative freedoms, such as freedom of speech and expression.

“We may not agree with the two (newly elected lawmakers), their language, but we have to protect their rights because they are elected members,” Lee said. “If (Beijing) can deprive them this time, they can deprive others because of other speeches or language or protest.”

After the protest march, several thousand people protested in the evening 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 -- symbols reminiscent of student-led pro-democracy demonstrations in 2014 that swelled to such numbers they blocked key Hong Kong streets.

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.

Senior police superintendent Tse Kwok-wai said police arrested two men, aged 39 and 57, one for obstructing police work and the other for failing to show his identity card. “Police strongly condemn protesters for breaking the law,” Tse said.

Demonstrators held signs reading “Defend the rule of law” and calling for the city’s Beijing-backed chief executive, Leung Chun-ying, to step down.

Some said that if China’s top legislative panel issued its own interpretation on oath-taking, it would effectively undermine a Hong Kong court’s ongoing review of the case.

“In (the) long run, that will damage our confidence in the court,” said Alvin Yeung, a legislator.

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.

If such a situation were to persist, the Standing Committee said, it would hurt the interests of Hong Kong’s residents and China’s progress. “The central government cannot sit idly and do nothing,” it said.

The interpretation involves 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 reading “Hong Kong is not China,” they vowed to defend the “Hong Kong nation.” Leung crossed his fingers, while Yau used the F-word in her pledge.

Their oaths were ruled invalid, but subsequent attempts have resulted in mayhem in the legislature’s weekly sessions.

Saturday’s comments indicated that the Standing Committee intended to use its interpretation of the article to send a strong message against separatism - and could ultimately lead to the democratically elected lawmakers’ disqualification from office.

Such an outcome would be favorable to China’s Communist leaders, who are alarmed by the former British colony’s burgeoning independence movement, but is also likely to plunge their troubled relationship into fresh turmoil.

Maria Tam, a Hong Kong deputy to the National People’s Congress, told reporters in Beijing on Saturday that the Standing Committee has the “final say” on the dispute, and that Hong Kong’s highest court would accept the panel’s interpretation as binding.