Two Filipino domestic workers have lost their legal bid for permanent residency in Hong Kong.
It is the final decision in a case that affects tens of thousands of other foreign maids in the southern Chinese financial hub.
The Court of Final Appeal was unanimous in its ruling, siding with the government's position that tight restrictions on domestic helpers mean they do not have the same status as other foreign residents.
Lawyers for the two had argued that an immigration provision barring domestic workers from permanent residency was unconstitutional.
The decision means Evangeline Banao Vallejos and Daniel Domingo are not allowed to apply to settle permanently after living at least seven years in Hong Kong. Ms Vallejos has worked in Hong Kong since 1986 and Mr Domingo since 1985. Neither appeared at court.
The case has split the city, home to nearly 300,000 maids from mainly south-east Asian countries. Some argue that barring maids from applying for residency amounts to ethnic discrimination.
But other groups have raised fears that the case would result in a massive influx of maids' family members arriving in Hong Kong, straining the densely populated city's social services, health and education systems. Supporters of the maids say those fears are overblown.
Members of an activist group chanted "We are workers, not slaves" and other slogans on the courthouse's front steps after the ruling was released.
Hong Kong is a special administrative region of China and permanent residency is the closest thing it has to citizenship. Foreigners who work in other professions are eligible for permanent residency after living in Hong Kong for seven years. Those who have it can vote and work without needing a visa.
Government figures cited by a lower court in this case said an estimated 117,000 foreign maids had been in Hong Kong for that length of time as of 2010.