People quarantined at a facility in Groblersdal, Mpumalanga, have won their court bid to be moved to an alternative site fit for human habitation or to self-isolate at home - if they test negative.
They claimed they were not tested for Covid-19 and were being forced to live in "appalling conditions".
On Wednesday, the Gauteng High Court in Pretoria granted a draft order by lobby group AfriForum and three applicants who are in quarantine at the facility.
The order was granted after the case was not opposed by the respondents who included the national ministers of health, police and cooperative governance and traditional affairs as well as the Mpumalanga health MEC.
The court heard all the respondents, except for Health Minister Zweli Mkhize, said they would abide by the court's decision.
READ | Court battle looming to test and release South Africans in 'appalling' Mpumalanga quarantine facility
The draft order, which initially sought to force the government to test the people held at the quarantine facility, was amended after a letter from the state attorney said tests have since been conducted.
According to the order, people who tested negative should be allowed to self-isolate at home until 14 days were up from the date of repatriation.
Mkhize was ordered to make an alternative quarantine facility available that was fit for human habitation, and which also complies with World Health Organisation (WHO) standards.
The order also prohibited the use of the quarantine facility in Groblersdal until it had been restored to be fit for human habitation and met WHO standards.
On Sunday, City Press reported seven individuals, who were among a group of South Africans repatriated from Mozambique on 27 April and taken to the Zithabiseni Resort & Conference Centre in Groblersdal, claimed they had not been tested and were living in a place teeming with cockroaches and rotten cardboard.
They reportedly said they were being served "sub-standard" food.
Melanie Nel, one of the people quarantined at the facility, told City Press everybody was complaining about the food.
"We're not eating it and are currently providing for our kids from the limited supplies we were able to bring with us.
"The bottom line is that we're all healthy, but are concerned that we and our kids will get sick in this place. All we want is to get tested and, if we're negative, we want to go home. We're willing to pay for our own tests, but we're not allowed to," she reportedly said.
READ | Quarantined South Africans head to court to demand their release
AfriForum's head of policy and action, Ernst Roets, told News24 the organisation had sent a medical team to the camp on its own initiative.
"Some of the residents at the camp had asked for private medical assistance, but this was refused."
AfriForum said people at the facility were being held against their will.
However, Department of Health spokesperson Popo Maja said the 14-day quarantine period was mandatory for everybody who crossed South Africa's borders.
"The 14-day quarantine period applies to everyone who has been abroad, whether they appear healthy or not. We need to observe whether people display symptoms consistent with Covid-19. This happens over a period of 14 days, at the expense of the state. That is what quarantine is."
Maja said private testing before the completion of the required 14-day quarantine period was not an option as the result might be a false negative.
"This is also for the protection of other members of society."