Image copyright EPA Image caption Yau Wai-ching (left) and Sixtus Leung (right) have refused to pledge allegiance to Beijing

Beijing has made an unprecedented intervention in Hong Kong politics to block two lawmakers from taking office.

Pro-independence elected lawmakers Sixtus Leung and Yau Wai-ching have refused to pledge allegiance to Beijing when being sworn in.

Beijing has now interpreted a section of Hong Kong law to mean any official who does not swear the oath properly cannot take office, said state media.

The move comes after weeks of chaos in the Hong Kong legislature.

There were also protests, and some scuffles, in Hong Kong on Sunday night, with at least four arrests.

Hong Kong's Chief Executive CY Leung said his government would "fully implement" the ruling.

Image copyright AFP/Getty Images Image caption Hong Kong police used pepper spray on protesters on Sunday

Hong Kong is semi-autonomous under the "one country, two systems" framework in place since it was returned to China in 1997.

But its mini constitution, the Basic Law, states Beijing still has the final say in how to interpret its laws.

Beijing's bigger picture - Carrie Gracie, BBC News, China editor

For Hong Kong's democracy movement, China's intervention is a challenge to freedom of expression and judicial independence, but for Beijing the bigger picture is paramount.

All talk of independence is seen as threatening and elsewhere in China, separatism is a crime and campaigning for independence results in a lengthy jail term.

To allow elected members of Hong Kong's legislature to use such a high-profile public platform to insult China and talk of a Hong Kong nation was unthinkable.

Hong Kong's courts do still uphold the freedoms promised when Britain handed the territory back to China nearly two decades ago.

But this intervention from Beijing is a reminder that China is determined to decide the limits of those freedoms.

The question for Hong Kong's young democracy activists now is where to take their defiance next.

The interpretation by Beijing's rubber-stamp parliament, the National People's Congress (NPC), marks Beijing's most far-reaching intervention in Hong Kong since the handover.

Mr Leung and Ms Yau belong to the Youngspiration party, which sprang from the 2014 Occupy Central pro-democracy protests. They have called for Hong Kong to break away from China entirely.

Image copyright Reuters Image caption Ms Yau had unfurled a banner saying"Hong Kong is not China" during one of her oath-taking attempts

They were elected in September, and have attempted to take their oaths several times, but each time have provocatively changed the wording.

Their attempts included using a variation of a derogatory word for China, and displaying a pro-independence banner.

Their oaths were invalidated amid chaotic scenes in the Legislative Council (LegCo).

China's intervention came before a local court could issue its own ruling on whether the pair could be sworn in again.

The Beijing ruling states that lawmakers taking their oaths must do so "sincerely and solemnly". They must "accurately, completely and solemnly" read out the portion of the oath that swears allegiance to Beijing, it said.

Failure to do so would disqualify the lawmaker from taking office.

While it does not name them, the ruling effectively means Mr Leung and Ms Yau will not be allowed to take their seats.

A spokesman for Beijing's state council was quoted by Xinhua as saying the move was "absolutely necessary", and "complies with the common aspiration of the entire Chinese people" including those in Hong Kong.

Li Fei, deputy secretary of China's top legislative panel, warned there would be "no obscurity and no leniency" in Beijing's "firm and clear attitude towards containing and striking the Hong Kong independence forces".