Johannesburg has always been a frontier city. Once described as Monte Carlo imposed on Sodom and Gomorrah, it has been the kind of place where men - many of them Scottish mining engineers - when they were not drinking or whoring were betting on anything, including how many flies would land on a lump of sugar.

It is sited on one of the unlikeliest places for a great city - atop a bleak, rocky ridge at 6000 feet above sea level, on the great southern African plateau, where winter temperatures dip below zero.

But after 120 years of existence, it remains the true El Dorado, sitting on two great arcs of the most abundant and valuable mineral deposits in the world - gold to the south, the original source of the city's wealth, and platinum to the north in quantities so vast and strategically important to the world economy that it guarantees riches into the 22nd century.

It is not a city for the over-fastidious. Wealth is pursued with vulgar, naked greed. Last week, arrests began for the murder of corrupt gold-mining magnate Brett Kebble, shot to death in his sports utility vehicle a year ago. The first arrest on charges of murder and conspiracy to murder was of Glenn Agliotti, long under investigation for racketeering, money laundering, drug trafficking and links with the mafia. But in a case that seems destined to open the biggest can or worms in South Africa's colourful criminal history, it turns out that the national police chief, commissioner Jackie Selebi, is a close friend of Agliotti and calls are out for the commissioner's suspension.

Almost unnoticed in the city of sin's excitement over the Kebble-Agliotti-Selebi affair has been the uncovering of another remarkable story in Johannesburg's romance/dance of death with gold.

The most productive gold mines are veritable underground cities, with tunnels winding for hundreds of miles more than two miles below the surface of the Earth and temperatures reach 40C and upwards. Famous mining companies, such as AngloGold and Gold Fields, continuously pump down refrigerated air into the subterranean cities where miners and other workers wear special jackets packed with ice to counter temperatures so high that the rock itself is hot to the touch.

Around Johannesburg are the huge illegal slums and shack dwellings of the poor. Underground, too, it has been discovered, there are slum dwellings of the desperate. In disused shafts and tunnels, smugglers live for up to a year at a time below ground without surfacing, mining illicit gold estimated to be worth nearly £400 million a year for three international criminal syndicates.

The unlawful miners "hijack" closed-off sections of legitimate mines, plunder them and provide the syndicates with tonnes of gold to smuggle abroad. Armed with handmade grenades to fend off intruders, they face death by suffocation and even insanity in the appallingly nightmarish conditions in which they live.

"There is no fresh air, it can be as hot as 38˚C, everything is very compressed and the humidity is very high," said police explosives expert, superintendent Joe Meiring. "They work there, they sleep there, they eat there. It is hot and dark, and they age very quickly. They even smoke down there, which is very dangerous because of the methane gas present in mines which can explode as a result of the slightest spark."

Meiring was one of the commanders of a 20-strong police team, which had undergone months of special training, that last week invaded one of the illegal tunnel complexes and arrested 60 rogue gold-diggers. All of them were black, all of them typically desperate to do anything to earn a living in an economy where unemployment runs at more than 40%, where social welfare benefits are meagre, and where the gap between the fabulously wealthy - both black and white - and the overwhelming majority of the desperately poor is as stark as it is shocking.

Unable to drive out their neighbouring "slum dweller" panhandlers, who use AK-47 assault rifles and beer bottle "grenades" stuffed with explosives and iron waste shrapnel as deterrents, the mine companies turned to the police to begin tackling the problem.

Before making their first assault, Meiring and his men practised tactics more than two miles below the surface, acclimatising to the heat and confined spaces, in a mine to the west of Johannesburg - better known to the hundreds of thousands of black miners who have worked in its bowels as Egoli (the City of Gold).

Mike Fryer, the national assistant police commissioner, said the nature of the criminal syndicates behind the illicit mining would begin to be revealed when the first men arrested come to trial. But he said the tunnel workers were small fry in comparison.

"This is organised crime," said Fryer. "The gold is going upstairs and the question is: where is the money going and what is it being used for?"

Fryer described the first police assault into the tunnels as "very dangerous", adding: "We bought the officers some new equipment because they can't use guns down there. Bullets could spark gas explosions Our biggest problem is that they the illegal miners were using explosives and handmade grenades to threaten the people underground. If one of those goes off in the wrong place, the whole thing could come tumbling down."

He declined to describe the new equipment, for fear it could jeopardise future operations into the tunnel complexes, but said that in the first successful raid against the gold pirates "they actually threw one of their handmade grenades, but nobody was hurt. They were lucky because it was a relatively stable environment. Further down the shaft it would have been horrific."

The illegal miners - known as the Zama Zama boys, which translates as "let's try our luck" - survive on bread, giant bottles of Coca-Cola, valued for its high energy content, and peanuts, rich in protein, smuggled in for neat profits by legitimate miners.

The pirate miners sleep on bare boards. As well as the constant pitch-black darkness, intense heat and high humidity, the miners have to contend with deadly mercury fumes, generated when the panhandlers put the ore through an initial process involving grinders, mercury and cyanide. Meiring said he knows of at least one case of an illicit miner dying from mercury poisoning: his colleagues left his body next to a legitimate lift for removal and burial.

"They sleep, stand up and work, and sleep, stand up and work," said Meiring. "There's nothing else for them to do." However, the superintendent added that the pirates have women living with them in their underground lairs and that they even have methods of receiving mail. They enter the mining complexes through disused shafts and sometimes by using legitimate miners' clock-in cards.

Meiring said the illicit miners mainly use commercial explosives to loosen the rock and that they have three main methods to defend themselves: lSelecting an area and rigging it with explosives, creating deadly booby traps; lThrowing handmade hand-grenades at authorities or legitimate miners approaching them; lUsing the "command wire" method, common in Iraq, where a bomb is concealed and detonated from a distance of about 100 yards if "visitors" do not know the "secret code".

How the gold is smuggled out of the illegal workings, further processed and then sent abroad by the syndicates is only likely to emerge once the trial begins of the first detained gold pirates, who remain in custody and have been charged with illegal possession of gold and explosives.

South Africa's Institute of Security Studies estimate that mining companies lose some 350 tonnes of gold a year to the pirate syndicates - about one-10th of total gold production. Although gold is becoming a relatively smaller part of the total economy, some half a million South Africans remain dependent on the industry which produces more than 12% of the world's gold.

It is estimated there are 600 million ounces of gold still to be mined in Johannesburg's Witwatersrand gold basin, equal to the amount of gold that has been extracted so far since 1885, when the first gold-bearing lump of rock was found.

But the technical problems of extracting the gold become more challenging by the year. In the late 19th century, the ore-bearing reefs broke the surface, but they were mined out long ago and now the gold companies have to go deeper and deeper to get at the gold ore seams which slope downwards towards the southwest.

AngloGold's Tau Tona (Great Lion) mine, 40 miles southwest of Johannesburg, is the deepest and biggest in the world with more than 500 miles of tunnels.

Engineers are currently excavating down to record new depths of nearly three miles in the expectation of extending mine life to 2020 and extracting another 72 tonnes of gold. With each drop of 1000 feet, the temperature increases by 1˚C.

At the new Tau Tona depths, miners will be working in temperatures as high as 50˚C, requiring cooling systems of enormous power and sophistication with capacities more then three million times that of a domestic refrigerator. The most advanced South African gold mine cooling system currently makes 20,000 tonnes of ice a day, which is crushed and pumped along pipes that run down through the mine tunnels and galleries. As the iced water warms up it is pumped back to the surface to be re-frozen.

None of this would have happened had it not been for Scotsman John Jack, who in 1887 took a rock sample, extracted by a pioneer prospector from the rocky ridge that would become Johannesburg, to Glasgow.

There, two doctors, brothers Robert and William Forrest, and JS MacArthur, a chemist, developed an ingenious method to extract gold from the crushed ore. Their cyanide-zinc process formed the basis of Johannesburg's wealth, and the technique is being used today by the pirate miners.