The Western Cape High Court has granted the City of Cape Town an order prohibiting refugees and asylum seekers living in and around the Central Methodist Mission church from interfering with City officials.
The order, which was handed down on Monday, also forces the refugees to comply with City by-laws at the venue on Greenmarket Square.
However, Judge Daniel Thulare also ordered the City to, within seven days, provide a suitable venue for the Department of Home Affairs to process the refugees and asylum seekers, and for the City to assist those in distress.
Thulare said the refugees had established a self-governing organisation in the city, and that "the City is within its rights to enforce the rule of law".
The more than 600 foreign nationals sought refuge in the church after police forcefully dispersed a sit-in protest near the offices of the UN High Commissioner for Refugees (UNHCR) in October, at the Waldorf Arcade on St George's Mall in the city centre.
They want the UNHCR to remove them from South Africa because of xenophobic attacks last year.
More to follow.