When Britain and China agreed that Hong Kong would be governed by the rule of law for 50 years after its return to China in 1997, the question of whose law was left open.
Yesterday it was finally answered when Hong Kong's highest court ruled that Beijing had the right to overturn its verdicts by reinterpreting the territory's constitution, known as the Basic Law.
While the former British colony continues to enjoy wide civil liberties, new limits have been set on its independence by the ruling, and Hong Kong courts will be powerless in future to challenge any re-interpretation of its laws by Communist China.
The decision by the five judges of the Court of Final Appeal came in a landmark case involving the right of abode. It provoked a violent protest by main land Chinese immigrants outside government headquarters in Hong Kong.
Police sprayed mace gas on several protesters, who threw rubbish bins and wielded broomsticks in clashes which left five police officers and three demonstrators injured, according to a Reuters report.
The protesters were forcibly prevented from entering the building where Hong Kong chief executive Mr Tung Chee-hwa has his office.
During the protest a woman with a loudhailer called out: "You can jail us, you can kill us, we will not leave," referring to an estimated 1,000 mainland Chinese who now face deportation from Hong Kong.
In January, the Court of Final Appeal ruled that the Basic Law guaranteed any child of a Hong Kong resident the right to live in the territory. Mr Tung, claiming that it would be unable to cope with a possible influx of 1.5 million immigrants with Hong Kong parents, successfully asked the National People's Congress or parliament in Beijing to reinterpret the immigration law.
Many Hong Kong men maintain second families on mainland China, notably in a suburb of the adjoining city of Shenzhen dub bed Second Wives' Village, but Democratic Party members in Hong Kong claimed the 1.5 million figure was exaggerated.
Yesterday, the court rejected an appeal by 17 mainland Chinese claiming a constitutional right to live in the territory because they had one parent there. Chief Justice Andrew Li said parliament had the power to make a valid and binding interpretation which the Hong Kong courts were duty bound to follow.
Civil liberties groups complained that the decision could seriously erode other freedoms. "It is now clear as a result of this judgment that any part of the Basic Law can be `interpreted' at any time by the Beijing government to mean whatever it wants it to mean and the Hong Kong courts will be powerless to resist," the Hong Kong Human Rights Monitor group said.
"Traditionally, communist systems of law rely on interpretation to make the law mean whatever the Communist Party wants, so making guarantees of freedom worthless."
Mr Rob Brooks, a lawyer for the immigrants, said: "It's obviously bad for Hong Kong" and "should make people in Hong Kong less comfortable about their constitutional rights".
However Hong Kong's secretary of security, Ms Regina Ip, said: "This has actually helped to clarify the limitations of the power of our courts."