Eleven illegal miners were rescued in South Africa on Sunday night after being trapped underground, apparently by a rival gang intent on stealing their gold.

The group had broken into a remote, abandoned mine shaft on Saturday to dig for the precious metal, but ended up being robbed and caught inside when their assailants blocked the exit with a concrete slab and boulders. They spent a miserable night underground before being rescued on Sunday, emerging to find emergency vehicles, TV crews, and police seeking to arrest them.

Early reports had been of up to 200 people trapped underground. As dusk fell with just 11 rescued from the mine east of Johannesburg, officials admitted that they could not be certain whether there were more men still underground, refusing to be rescued because they feared prison.

Rescuers said it was too dangerous to go down and look for them but they would leave a ladder on the wall of the square metre hole so any remaining could climb out if they wished to. Werner Vermaak, of the emergency service operator ER24, said he heard from many people at the scene that the miners were trapped deliberately. "It's quite common for rival gangs to close off mines," he said.

It could have become the miners' tomb, but the men were saved when a routine police patrol came across one of their friends at the site.

The rescue began at 10am on Sunday , with the help of a crane and other heavy equipment. When rescue workers said the men had claimed they numbered 30, and that 200 or more were trapped in a tunnel below, it attracted the attention internationally of both Twitter and television news.

The concrete slab was removed and rescuers in yellow helmets, dark blue overalls and boots clustered around the shaft as the miners emerged into the late afternoon sunshine, some reluctantly because of what was to come. All were given medical treatment, then taken away in a police van to be charged with illegal mining.

Moshema Mosia, the head of disaster and emergency management in the Ekurhuleni area, said: "At this stage we can't say how many people are still left there. What we can say is that 11 people managed to come and were rescued. … The medical team gave them attention, they did a diagnosis. They are healthy and they are being looked after."

The 11 survivors "did not give any indication as to whether there are still some people there", he added. "They didn't say much. When we asked if they were OK, they indicated they were OK."

Illegal mining of abandoned shafts is common in South Africa and has been dubbed Johannesburg's second gold rush. The men, known as zama zama, are typically from poorer African countries and often live underground in dangerous and precarious conditions. Fatal accidents and turf wars between rival gangs are common.