Nine copper miners who have been trapped underground for the last week have been rescued alive.

Rescuers have freed nine copper miners who had been trapped underground for seven days after a cave-in in southern Peru.

The miners exited the Cabeza de Negro mine one by one starting at around 7 am local time (12:00 GMT) on Wednesday, wrapped in blankets and wearing dark glasses to protect their eyes against the bright light of day, reporters at the scene said.

One of the miners had difficulty walking, and was wearing an oxygen mask.

President Ollanta Humala and relatives of the miners greeted them as they emerged, and miners raised a Peruvian flag atop a rustic pole to celebrate the rescue.

Rescuers had to proceed cautiously because of the danger of further cave-ins as they dug through rock and soil to reach the miners, who were trapped in a horizontal gallery 250 meters underground.

Al Jazeera’s Mariana Sanchez, speaking on the phone from Quilque, Peru, said that the miners had walked tehmselves out of the cave, after being trapped approximately 200 meters underground.

“They asked the doctors not to put them on stretchers, and they said they felt healthy enough to walk,” she said. “They were mainly treated for dehydration.”

“The president was also waiting for the miners to emerge, and he spent the night [outside the cave],” our correspondent said.

She went on to explain that the primary reason for their general good health was due to the hose the miners had brought with them into the cave for oxygen. “Through that hose the rescue team was able to feed them water and oxygen.”

Trapped since Thursday, the miners, aged 22 to 59 and including a father and son, had escaped injury in the cave-in and were all in the same place.

But as the ordeal wore on, some began to complain of health problems, including stomach disorders.

Rescuers were able to get close enough to supply them with oxygen, water and soup through a metal tube.

Cabeza de Negro is an unlicensed mine that was abandoned more than two decades ago by its owners, but continues to be exploited.

With international market prices for metals high, informal “wildcat” mining has been on the rise in recent years in Peru, one of the largest producers of silver, copper and gold.

The Peruvian miners’ fate recalled a similar case in Chile that made world headlines.

In August 2010, 33 miners were trapped after a cave-in in the San Jose gold and copper mine in northern Chile, after 69 days and a spectacular rescue operation with the world watching, they were brought out safely.