In a move opponents said undermines the rule of law in Hong Kong, China's legislature today overturned a decision by the territory's highest court that had opened the door to a large influx of mainland immigrants.

Hong Kong's Chief Executive Tung Chee-hwa had asked the legislature in Beijing to intervene and reject the Hong Kong court's ruling, warning that as many as 1.6 million new residents would rush in and overburden the already crowded metropolis. Public opinion surveys show that a majority of Hong Kong's 6.8 million residents also wanted to keep the immigrants out.

But today's decision by the 160-member Standing Committee of the National People's Congress in Beijing raised an outcry among legal experts and government opponents in Hong Kong. Hong Kong's leading opposition figure, Democratic Party head Martin Lee, said in a statement that Tung and leaders in Beijing struck a "mortal blow" against Hong Kong's legal system.

"They have succeeded in ripping open a gaping hole through which they will attempt to make further incursions that threaten to destroy the high degree of autonomy guaranteed to Hong Kong under the Basic Law," Lee said.

Outside Hong Kong government offices, hundreds of would-be immigrants shouted and waved signs in protest.

The ruling overturns the January decision that granted residency rights to all mainland children of Hong Kong residents -- including those who were born before their parents came to the territory.

Observers credit the former British territory's strong legal traditions with helping to transform the former backwater into one of the world's financial capitals. When Hong Kong reverted to Chinese rule on July 1, 1997, China promised to allow the special administrative region to manage its own affairs for 50 years in accordance with a mini-constitution known as the Basic Law. That document was cobbled together by Beijing and Britain.

One of the sticking points was whether Hong Kong should have a supreme court. China eventually agreed that Hong Kong would have a Court of Final Appeal as part of the "one country, two systems" policy. It was supposed to have the final word in interpreting the Basic Law.

The court's first politically important ruling -- which Beijing reversed today -- was how to deal with families divided by China's border with Hong Kong. The Basic Law holds that children of Hong Kong residents have the right to live in the territory. In January, the court interpreted that to mean that the sons and daughters of Hong Kong residents have the right to live in Hong Kong, even if their parents were not residents when the children were born.

At Tung's behest, the Chinese legislature today threw out that interpretation, saying instead that at least one of the would-be immigrant's parents must have been a resident at the time of the child's birth. The court "failed to comply with our original legislative spirit," the legislature ruled.

Tung said the decision proved that he had the territory's best interests at heart.

"We have taken this course of action because there were no alternatives," he said. "This is not something we would like to do if we can help it."

Joseph Cheng, a political scientist at the City University of Hong Kong, said powerful pocketbook issues convinced the public to largely support Tung.

"Ordinary people wanted the government to find a quick fix to stop the massive influx of people into Hong Kong," he said. "In times of serious economic difficulty in Hong Kong, and an unprecedented high unemployment rate, people are concerned with jobs."

While dire predictions that China would crack down on Hong Kong's freewheeling political culture after the 1997 handover have proved false, some observers see a less obvious erosion over the last two years of some of the legal basics that have made Hong Kong successful.

Michael DeGolyer, director of the Hong Kong Transition Project, said recently there have been several instances when authorities seem to have made exceptions to the rule of law.

Two high-profile trials -- those of criminal syndicate boss and kidnapper Cheung Tze-keung, and the brutal Telford Garden poisoning case -- were held in China, rather than in Hong Kong where the crimes where committed, DeGolyer noted. A huge government contract was also questionably awarded to the relative of a Hong Kong tycoon, he added.

"The pattern of exceptions has made people really concerned about this bigger exception," DeGolyer said, referring to today's ruling. "If you don't have a fixed procedure for enforcing and making the rules . . . then you really have to raise the question of whether the rule of law is alive and well."

CAPTION: Demonstrators attempt to jump over a police cordon to enter a Hong Kong government office during a protest against the Chinese legislature's amendment of an immigration ruling made by Hong Kong's highest court.