HONG KONG (AP) _ Angering hundreds of Chinese who say they have the right to live in affluent Hong Kong, a court ruled today the territory's government can deport them back to the mainland, where they then must fight for clearance to come back.

The government and 17 immigrants are fighting over how to interpret a January ruling by Hong Kong's highest court that anybody with at least one Hong Kong parent has the right to live in the territory.

The government fears the so-called right of abode decision will open a floodgate to hundreds of thousands of immigrants who could overwhelm Hong Kong's health, education and welfare systems.

Justice Wally Yeung Chun-kuen sided with the government on one aspect of the right of abode, ruling that mainland people who are already in Hong Kong on expired visas cannot stay here while they apply for residency under the high court guidelines.

Would-be immigrants who gathered at the Court of First Instance were outraged.

``I'm very disappointed,'' said a man who identified himself only as Mr. Lau. He said his 8-year-old son faces deportation if the mainland residents lose their appeal. ``I'm very unhappy. If we apply on the mainland, how long will that take?''

Critics say the mainland system that hands out exit visas to emigrants is slow and corrupt.

By midafternoon, immigration officials had detained about 30 mainland Chinese with expired visas and planned to deport them, Immigration Department spokesman Felix Tsui said.

Yeung said allowing applicants to remain in Hong Kong would encourage ``a large but unverified, unplanned and unregulated influx'' of mainland Chinese.

``We can be talking about tens of thousands, a few hundred thousand or even over a million people. Is the fabric of our society strong enough to withstand such influx?'' the judge said.

An attorney for the mainland Chinese pointed out that Hong Kong has been accepting immigrants for decades as it grew from a tiny British colony to a crowded, modern city of nearly 6.8 million people.

``What did we do in the '50s and '60s?'' Pam Baker said. ``They came and we took them. What are they (the immigration officials) afraid of?''

The plaintiffs can stay until their appeal is heard, but other mainland Chinese who have overstayed their visas in Hong Kong can be deported now.

Regina Ip, secretary for security, said there are about 1,200 people who fall into this category. Ip said the ruling sends a clear message that applications for residency should be made from the mainland.

Although Hong Kong became part of China when British colonial rule ended in July 1997, it is governed as a largely autonomous ``Special Administrative Region,'' and border controls between Hong Kong and southern China are stringent.

But many people pass back and forth for work and other reasons, and thousands of children have been born through the years to one Hong Kong parent and one mainland parent.