Sheltered from the world by an ancient religious curse and a modern Middle East conflict, a spectacular ruined city lies almost hidden in the northern deserts of Saudi Arabia. More than 100 tombs and burial chambers are carved elaborately into rocky outcrops across the sands of this city, still bearing names and ornate religious symbols chipped into the sandstone 2000 years ago. Nearby, volcanic mountains decorated with the 10,000-year-old art of prehistoric hunters, tower over a palm-filled oasis and an abandoned mudhouse village.

Through them snake the remains of an Ottoman railway, built to carry Muslim pilgrims from Damascus to Medina and blown up by Lawrence of Arabia’s Bedouin army in World War I. Saudi Arabia’s top tourist attraction is rich in history and austere desert beauty. Only the tourists are missing.

“We get about 50 foreign visitors a month,” says guide Hamid Benbouazza. “Before the attacks in Riyadh last year, we used to get more, but people are scared.”

Saudi Arabia, a deeply conservative Muslim kingdom, has always been ambivalent about letting tourists cross its borders. A wave of Muslim militant violence since May last year has further dented hopes of opening up to the world. A bloody attack in the city of al Khobar six months ago was particularly devastating. One morning recently, during the peak holiday season, just a few small groups of foreign visitors and Saudis explored Meda’in Saleh, the southern capital of a Nabatean trading kingdom which flourished two millennia ago.

Its northern sister city Petra, the “rose-red city half as old as time”, is the centrepiece of neighbouring Jordan’s tourist industry and attracts half a million people a year. But the empty tombs at Meda’in Saleh – nearly 1000km north-west of the capital Riyadh – have never drawn crowds, despite holding a strategic position on the pilgrim trail from Syria. Religious texts and local legend about Meda’in Saleh’s ancient misdeeds intertwined over the years until it was considered to be cursed.

“God showered gold here for seven days, and gave them a camel which provided milk for all,” said Sultan, a Saudi man leading his children down a row of tombs carved into golden-brown rock. “But they were corrupted and rejected his message, so he made the earth swallow them up.”

When the Prophet Mohammed passed through the area, he rejected food and water offered from Meda’in Saleh. For centuries, pilgrims trekking south to Mecca averted their eyes as they passed, fearful of stirring the divine wrath which they believe struck its early pampered inhabitants.

The ancient curse lingered on into the 20th century, when Saudi Arabia’s highest council of Muslim scholars decreed that residents living close to the ancient tombs should be relocated. When the Ottoman rulers, whose empire stretched from Istanbul down to Arabia’s western coast, built a railway linking Damascus to Medina, they laid the line through Meda’in Saleh. Within a few years, the Hashemite rulers of Mecca, backed by Britain, rose up against the Ottoman Empire and targeted the railway as part of a guerrilla war. They blew up the tracks in hit-and-run attacks and the line never reopened.

A century-old black steam engine still stands in a railyard just north of the rock tombs, near a Turkish garrison fort. Further south, a lone carriage sits on a length of track in a narrow valley between the mountains, the latest relic from civilisations stretching back through the Ottomans, the first Arab Muslims, Nabateans, Lihyanites and primitive hunters. Eighty years after the railway’s destruction, Meda’in Saleh is edging out of isolation. A mountain road opened this year brought the Red Sea airport of Al-Wej within two hours’ drive.

But there is little chance of any tourist stampede. Saudi Arabia’s conservative royalty and religious scholars have shown little enthusiasm for visitors, aside from the millions of Muslims who make the annual pilgrimage to the holy cities of Mecca and Medina, and tour companies are hard pressed to promote a country where alcohol is banned, women must cover themselves from head to foot and summer temperatures top 50°C. Young women are not allowed to travel unaccompanied.

Recent steps to open up the kingdom and diversify its oil-dependent economy have been undermined by al-Qaeda attacks on foreigners, including suicide bombings, kidnappings and shootings. Western countries advise their nationals to avoid all but essential travel to the kingdom and the US has urged thousands of its citizens to pack up and leave.

“Every single booking we had for June and July was cancelled. My boss told me to go home,” one Meda’in Saleh guide said.