More than 3,200 exhausted South African gold miners have been rescued from deep underground after they were trapped by a power cable accident.
The miners could only be brought to the surface in small groups
The final group was lifted to safety from Elandsrand mine, 80km (50 miles) from Johannesburg, officials said.
The accident had left the miners trapped 2.2km (1.4 miles) underground. Some had been there for 40 hours.
The miners were brought out through a small shaft normally used for mining equipment. None were seriously injured.
Only 75 workers could be hauled clear at a time, adding up to no more than 300 in an hour.
'Room for improvement'
One of the last miners brought to safety, Richman Maneli, told AFP news agency he was happy to be out.
"It has been 30 hours of suffering," he said. "We had no food, no water and we are exhausted."
Each group of miners was greeted with shouts of joy and whistling, South African Press Association (Sapa) reported.
Earlier, another rescued miner, Granny Makad, told South Africa's Mail and Guardian newspaper many of the trapped miners were crying and believed they would die underground.
"It was terrible," he said. "There was not enough air and they tried putting in more and ventilating the areas where we were trapped."
ELANDSRAND GOLD MINE
Elandsrand mine has 6.9 million ounces of proven reserves
Located 80km (50 miles) west of Johannesburg
It has two vertical shafts - a men/material shaft and a rock/ventilation shaft
A new mine, to be finished by 2010, is being built under the existing mine, which is still in use
Harmony Gold Mining bought the mine in 2001
The accident at the mine, owned by Harmony Gold Mining, happened at about 1000 (0800 GMT) on Wednesday morning.
Harmony chairman Patrice Motsepe said the incident was a "wake up call to all of us".
Minerals and Energy Minister Buyelwa Sonjica, who visited the mine, said it would be closed for six weeks to ensure it was safe to continue operations.
Ms Sonjica greeted some of the miners as they emerged and said the government wanted to "tighten up" mine safety laws.
"I wouldn't call it a crisis given that mining is risky in its nature, so incidents of this kind will occur, but I still think there is room for improvement and to reduce accidents in the mines," Ms Sonjica said.
She also complained that she and President Thabo Mbeki had not been informed of the accident by the company and learned of it from the evening news.
No serious injuries were reported, although there were cases of cramp and dehydration.
"All the miners are okay," National Union of Mineworkers (NUM) spokesman Lesiba Seshoka told the BBC News website.
The miners were trapped in a cramped space where temperatures could reach 30-40C (86-104 Fahrenheit).
A spokeswoman for the mining company, Amelia Soares, said the bottom of the shaft where they were trapped was well ventilated, and that the miners had had access to water.
Ms Soares said a compressed pipe column fell down the mineshaft, damaging steel work in the shaft and cutting electrical cords connected to the lifts underground.
The NUM blamed Harmony's practice of mining 24 hours a day, which the union said left little time for safety checks.
"Our guys there tell us that they have raised concerns about the whole issue of maintenance of shafts with the mine, but they have not been attended to," Lesiba Seshoka told the Associated Press news agency.
The Elandsrand mine is in the Witwatersrand Basin, which holds the world's largest gold deposit.
Gold is important to South Africa's economy, says the BBC's Peter Biles in Johannesburg, although the industry has been in decline in recent years.
ELANDSRAND MINE ACCIDENT
1 45m chunk of piping breaks away near mine surface
2 It damages steelwork and severs electrical cables as it falls down the 2.2km shaft
3 Miners move from bottom of Men and Material shaft to adjacent Rock and Ventilation shaft
4 Other miners working at about 2.6km join stranded colleagues
5 They are raised to the surface via a hand-winding system