Two Filipino women who had come to Hong Kong as domestic workers were not allowed to stay in the city after they lost their case in the Court of Final Appeal.

Milagros Tecson Comilang and Desiree Rante Luis gave birth to their children in Hong Kong during their contract period and requested to extend their stay in the city to take care of their children who have Hong Kong ID after their employment contracts expired.

After they were rejected by the Immigration Department, they filed a lawsuit and claimed the department had violated the human rights law. Comilang has been fighting for her right to remain in the city since 2007, while Luis has three sons and started her case in 2012.

As they faced setbacks in the Court of First Instance and the Court of Appeal, they appealed their cases to the Court of Final Appeal.

They raised the question of whether the Immigration Director was obliged by law to take into account the rights of the children when deciding whether their parents with no right of abode should be allowed to remain in Hong Kong.

On Thursday, the Court of Final Appeal ruled that the Immigration Department had the power to control immigration and expel those who do not have residency in the city although their children are permanent citizens, according to the Oriental Daily.

The top Hong Kong court’s decision on the case could impact thousands of children born in Hong Kong to parents who are mostly foreign domestic workers, or those who have overstayed their visas but are allowed to remain either to pursue an asylum application or for other reasons.

Read: Filipina moms win court bid to question expulsion from HK