By Sisi Tang

HONG KONG (Reuters) - Hong Kong's government won an appeal on Wednesday against a ruling that would have allowed roughly 300,000 maids to apply for residency, the latest twist in a legal battle that has split the city.

Under Hong Kong's constitution, foreigners are entitled to permanent residency - which brings the rights to vote, welfare and other services - if they have lived there uninterruptedly for seven years.

Immigration law, however, denies that right to foreigners who work as home helps, most of whom are from the Philippines and Indonesia.

The High Court said it supported that law, on the basis that it does not violate the city's constitution.

"A foreign domestic helper's stay in Hong Kong is for a very special, limited purpose from society's point of view - to meet society's acute demand for domestic helpers which cannot be satisfactorily met by the local labor market," the court said in its judgment.

"Their stays in Hong Kong are highly regulated so as to ensure that they are here to fulfill the special, limited purpose for which they have been allowed to come here in the first place, and no more."

Activists for the Filipino community quickly condemned the ruling, saying it discriminated against foreign maids.

"We don't want to be excluded ... because we have contributed a lot to Hong Kong society and economy, said Eni Lestari, spokeswoman for the Asian Migrants' Coordinating Body. "For (the) right of abode we are being automatically denied by the court, and this is very disappointing."

Most wealthy Hong Kong residents and expatriates consider a maid essential, many employing a live-in helper who cooks, cleans and helps with child-minding.

Some Hong Kongers feared a ruling in favor of right of abode would lead to a wave of immigrants heading to the city.

The lawsuit was initially launched by Filipino maid Vallejos Evangeline Banao, who scored a victory in September 2011 when a lower court ruled that she had the right to seek permanent residency in Hong Kong.

Between then and March 23, the Immigration Department had received 901 applications for permanent residency.

Her lawyer, Mark Daly, said he would review details of Wednesday's ruling, and was highly likely to appeal against the decision, this time to the Court of Final Appeal.

(Reporting By Sisi Tang; Editing by Daniel Magnowski)