A South African court Africa has ordered that a police blockade of a disused goldmine, in which hundreds of people are located illegally, be lifted.
Emergency services have been at the site, in Stilfontein, around 90 miles south-west of Johannesburg, for several days. Police have blocked food and water entering the mine to, as one government minister put it, "smoke them out".
The miners - who have been underground for a month - have so far refused to exit the mine over fears of being arrested. Among them are undocumented migrants who also fear deportation.
Police welcomed the order but said it would not stop them arresting miners who left the mine.
On Saturday, a court in Pretoria ordered that the mine "may not be blocked by any person or institution whether government or private".
It also said that any person in the mine should be allowed to exit, and that "no non-emergency personnel may enter the mine shaft".
The ruling comes after dozens of volunteers entered the abandoned mine to aid the miners, who reports suggest had resorted to eating vinegar and toothpaste to survive. Volunteers said they pulled a body from the mine on Thursday.
It also comes as police called in experts to assess the integrity of the mine shafts, to inform a decision as to whether they would conduct a forced evacuation, according to the AFP news agency.
Yasmin Omar, an attorney who helped bring the court case, told state broadcaster SABC that the ruling was a temporary order "that will at least allow us to get emergency relief to the people [who] need it".
She said a full hearing on the matter would take place on Tuesday.
"These people underground are dying," Ms Omar said, adding that the ruling means officials "must do all that is reasonable to give medical care to the people who are underground".
In a statement, the South African Police Service (SAPS) welcomed the court order, which it stressed did not prevent officers from making arrests.
It said: "All those who resurface will continue to be assessed by emergency medical personnel on site, as has been the case.
"Those that are in a good health will be processed and detained. Those that require further medical care will be taken to hospital under police guard."
The SAPS added that as of 16:00 local time (14:00 GMT) on Saturday, three of the miners had resurfaced.
More than 1,000 miners have already emerged and been arrested.
South Africa is a mineral-rich country. According to official estimates, it holds nearly 30% of the world's gold deposits and 88% of all platinum deposits.
But many mines have closed down in recent years and miners have been laid off, contributing to a black market that costs the South African government hundreds of millions of dollars each year.
In a bid to survive poverty, miners and undocumented migrants are increasingly entering closed mines to dig up their remaining deposits.
Some spend months underground, and illegal mining has spawned a small economy providing food and cigarettes to the miners.
However, the authorities are keen to end the practice. Illegal miners are sometimes recruited by criminal gangs and can be armed.