South African authorities say the last of the 3,200 workers who had been trapped more than a kilometer underground in a gold mine southwest of Johannesburg have been brought to safety.

The officials at the Elandsrand mine said the final group of 52 miners reached the surface Thursday evening local time. Officials say they had to raise the workers through a small elevator shaft and could not rescue more than 300 an hour.

Officials say the miners are tired and hungry, but are otherwise in good condition. One worker had to be treated for dehydration.

Mine operator Harmony Gold says the workers became trapped after a pipe broke and fell down a mine shaft, damaging electric cables that power the mine's elevator.

Production at the mine has been halted until an investigation into the mine's safety is complete.

Officials from South Africa's National Union of Mineworkers say they suspect lack of maintenance was the cause of the accident.

South Africa is the world's biggest producer of gold, and unions have often complained of lax safety conditions at the mines.

Some information for this report was provided by AFP, AP and Reuters.