Image caption Residents have voiced their concerns about allowing foreign domestic workers to apply for residency

The Hong Kong government has won an appeal against a ruling that could have allowed foreign domestic helpers to apply for residency in the city.

In September, the High Court said excluding maids from a rule allowing foreigners to settle in the city after seven years was unconstitutional.

The government appealed, fearing the ruling could lead to more than 100,000 foreign maids winning residency rights.

The case centred on Evangeline Banao Vallejos, a maid from the Philippines.

The Court of Appeal said in its 66-page ruling that "it must be up to the sovereign authority to decide the extent to which the status of permanent resident should be conceded to foreign nationals".

Analysis Most of Hong Kong's seven million residents welcomed a ruling by three High Court judges who have overturned last year's landmark case. That decision sparked an intense backlash against foreign domestic workers and the people who support them. The workers were caricatured as "cockroaches", a highly offensive term. The name calling makes it all seem personal, but at issue is a battle for resources. This is one of the most densely populated places on earth. The roads are crowded and living spaces are tiny. Competition for public services is intense. Mainland Chinese, who are ethnically no different from locals here, have been called "locusts" because some of them, too, want to live in Hong Kong.

Mark Daly, the lawyer representing Ms Vallejos, said it was "highly likely" that they would appeal against the decision in Hong Kong's highest court, the Court of Final Appeal.

"There are strict issues of law but there are also issues of principle. We think we can win on both," Mr Daly told BBC News.

"Ms Vallejos is the type of person Hong Kong should be proud to have," he added.

Ms Vallejos has lived in Hong Kong since 1986, working for the same family.

Protests

After the initial ruling, thousands of Hong Kong citizens marched to protest against the strain granting residency to maids could place on public services and the job market.

The government had estimated that 125,000 helpers would be eligible to apply for abode, and if each had a spouse and two children, that number of potential new residents could reach 500,000.

But groups campaigning for domestic workers accused the government of scare-mongering.

Delores Balladares from the Asian Migrants Co-ordinating Body, which represents domestic helpers' interests, said they were very disappointed by the decision.

"It legalises discrimination against migrant workers," she told BBC News.

The case had sparked widespread debate about the rights and working conditions of Hong Kong's 300,000 domestic workers, who mainly come from the Philippines and Indonesia.

Not just a luxury for wealthy families, they are a mainstay of Hong Kong family life and allow many middle-class mothers to work outside home.

Hong Kong's foreign maids fare better than domestic workers elsewhere in Asia, with a guaranteed minimum wage, statutory holidays and annual paid leave.

But their lack of residency rights means that if they leave an employer, they have only two weeks to find a new job otherwise they must return home.