Last Saturday night, they were the scene of grand celebrations. Ministers, governors, ambassadors and sober-suited academics from around the world gave speeches and watched dancers perform in diaphanous silk robes, bringing to life the world so vividly evoked in the cave paintings.
The high priests of what half-jokingly is described as "Dunhuangology" were gathered together for five days to celebrate the 100th anniversary of a chance discovery by Wang Yuanlu, a Taoist monk. The self-appointed guardian of the caves had been sweeping sand out of one when he broke through a false wall and stumbled across a secret cache of documents. It was one of the most remarkable discoveries made in China.
Sometime in the 11th century, for reasons no one is sure of, the 50,000 manuscripts were hidden there, as if in a time capsule - perhaps to protect them from an impending invasion or some other disaster. News of the discovery filtered out to the outside world just around the time when many countries were mounting expeditions to explore Central Asia. Britain backed a Hungarian, Sir Auriel Stein, who in 1907 was the first to buy some of the manuscripts and send them back to Britain. French, Japanese, Russian and American explorers soon followed and together their discoveries revealed hitherto unknown civilisations, languages and peoples who had flourished and decayed along the Silk Road.
"The plunder of the relics is a piece of painful history," declared Liu Chengshan, the deputy governor of Gansu, at Saturday's festivities. He said this had spurred mainland intellectuals to protect them. Now that China was stronger, it could protect its relics properly.
The significance of the Mogao Caves has shifted with the times. From 1943, Chinese painters fleeing the Anti-Japanese war came to this remote spot and began copying the murals. Among the greatest was Zhang Daqian, who helped establish a fascination for non-Confucian imagery and the flowing lines of this early period.
Since then, most Chinese art students have come here to spend a few months copying the murals. The influence is visible in the Socialist-era murals of many public buildings as well as tourist kitsch. The sacred Buddhist art is left out and replaced by images of flying maidens in Arabian costumes.
Study of the manuscripts took place largely outside the mainland, during the 1960s and 1970s, including at the Chinese University of Hong Kong. Professor Jao Tsung-i, the founder of Dunhuang studies in Hong Kong, was one of those honoured during the ceremonies.
Experts are still investigating the documents, determining which are forgeries and translating texts in languages like Sogdian or Tocharian. Chinese academic interest in the find has taken off, just as Dunhuang is emerging as a major tourist destination. The late paramount leader Deng Xiaoping visited this remote spot in the early 1980s and Jiang Zemin, now President, came in 1992, but mass tourism has only developed in the past five years. Last year 500,000 came to Dunhuang and about 300,000 visited the caves.
It is a curious experience. All but 20 or 30 of the caves are closed to the public. When TVB chairman, Sir Run Run Shaw, visited in the late 1980s, he agreed to pay for brown aluminium gates and grills to be installed across each cave. The crumbling cliffs are covered by a sort of brown pebble-dash and concrete gangways to stop them disintegrating. Yet as one passes the cave entrances with guides armed with keys and torches, it feels a little like a prison inspection tour where forgotten prisoners languish behind the metal doors. In fact, the Qing government once housed Russian prisoners of war here.
It was a sacred Buddhist site for more than 1,500 years. Many Hong Kongers and, above all, Japanese who flock to the site in large numbers appreciate this. Yet the groups of affluent mainland tourists and officials who troop around are unable to grasp the religious scenes portrayed on most of the murals. Dunhuang to them is about expressing reverence for national treasures. The exhibition, devoted to the history of the library cave and its scrolls, stresses the humiliation done to China by foreigners like Stein who "cheated" Wang Yuanlu by paying just £130 (about HK1,500 at current exchange rates) for the 29 cases he took back.
About 95 per cent of the documents consist of Buddhist sutras and are of little general interest. Many of the Chinese scholars addressing the five-day conference are more fascinated by what the remaining documents reveal about China. Yet the dances, music and costumes of the two-hour gala, performed in front of the grand pavilions housing the giant Buddha, betray a renewed popular fascination with Dunhuang, not so much as a testament to the culture of China's minorities but as a symbol of a cosmopolitan China.
Even the instruments played were based on what the caves revealed about life in the Tang dynasty, a period when the Chinese abandoned Confucian formality for the art and thought which entered along the Silk Road from the rest of the world. They adopted the dress, furniture, music, instruments and religions of their close Asian neighbours, and this is an idea the Chinese are now finding acceptable.