This weekend, the Palace Museum in Beijing is celebrating its 90th birthday. By the end of the year, together with the National Palace Museum, in Taipei, it will have received more than 20 million visitors. But few of them will be aware of the extraordinary story behind some of the treasures they have seen and the odyssey that has taken those artefacts on a journey of thousands of kilometres.

In 1933, after the Japanese army had conquered Manchuria and was threatening northern China, the directors of the original museum, in Beijing’s Forbidden City, moved 19,600 crates of treasures to keep them out of the clutches of the foreign aggressors. After all-out war began, in 1937, the directors hid the pieces in southwest China. In 1948 and 49, then president Chiang Kai-shek shipped 2,972 crates to Taiwan, where he built the National Palace Museum in 1965.

The Forbidden City Palace Museum now boasts 1.8 million pieces, including 53,482 paintings, 75,031 works of calligraphy and 159,734 items of copper, as well as 603,000 ancient books and documents, 367,000 pieces of porcelain and 11,000 sculptures, some of which date back to the Warring States Period (475-221BC). The museum in Taiwan possesses 696,000 pieces, including works of art, rare books and historical documents. Museums around the world compete to show exhibitions from the two collections. Last year, the Palace Museum attracted 15 million visitors, making it the most popular museum in the world; the National Palace Museum attracted 5.4 million.

THEIR STORY BEGAN ON November 5, 1924, when Puyi was expelled from the palace in which emperors had lived for 500 years. He had been allowed to remain in residence after the 1911 revolution but the new Republican government removed the deposed emperor when it was discovered that he, the eunuchs and other court officials were responsible for the widespread theft of the palace’s imperial treasures.

Inspired by the Louvre, in Paris, and other royal palaces in Europe, the government wanted to turn the imperial residence into a museum. The collection consisted of 1.17 million pieces, according to the first ever inventory, and the Palace Museum opened on October 10, 1925, the 14th anniversary of the Republic of China.

See also: Forbidden City museum restores vandalised centuries-old artefact to - almost - former glory

In 1933, when news of the decision to move the 19,600 crates for safekeeping was leaked, according to a detailed history published by the National Palace Museum, many in Beijing were enraged.

The pieces had to be transported in the middle of the night, with a military escort. Soldiers armed with machine guns rode on the roof of the train carriages carrying the crates on their journey south. Most worrying was the stretch around the city of Xuzhou, in Jiangsu province.

“We heard there was a plan to rob the train,” wrote Wu Ying, the museum official in charge of that operation and who penned several books about his life. “A cargo carrying treasures spanning 2,000 years happens only once in many lifetimes. The night before, we were informed that about 1,000 bandits had gathered in the area. They were discovered by soldiers. On learning that their plan had been uncovered, they withdrew. We had to make a detour of one day and didn’t reach Nanjing until the fourth day. There we could finally relax.”

From Nanjing, the pieces were moved to Shanghai for safekeeping and stored in a Catholic church in the French Concession. The government later built a modern museum in Nanjing, the new capital, in which to store them. (That building is still in use, as a branch of the Palace Museum and storage facility.)

But there was no respite from the Japanese. When they began their full-scale invasion of China in 1937, the museum directors decided to move the pieces again, out of the reach of enemy bombers. There were three major routes to the southwest provinces of Guizhou and Sichuan. Over the next eight years, museum crates were stored in temples, caves, tunnels, private homes and other safe places.

After the Japanese surrender in August 1945, the pieces were gradually moved back to Nanjing, but civil war prevented their return to Beijing. During the eight-year odyssey in the southwest, no pieces were lost or stolen, say Fung Ming-chu, director of the National Palace Museum, and her predecessor, Chou Kung-shin – a tribute to the dedication of the staff who accompanied the collection.

Fung also credits another player.

“If it had not been for the central government, the railways would not have been available for transportation. From 1933 to 1945, the museum was on the road for 12 years. During that time, the Japanese military launched its all-out attack. If the government had not acted promptly, the pieces would have been destroyed.” The Chinese government also had accurate intelligence on its side. “Take the [1944] attack on Changsha as an example,” says Fung. “Some pieces had been stored in the library of Changsha University [in Hunan province]. The government got word that an air attack was imminent and ordered the pieces to be moved. When the attack came, the pieces had gone but many of the people had not.

“The staff of the museum were very hard working and dedicated. They stayed with the pieces every day. For each shipment, there was a team which was responsible. They did not leave the pieces unattended. If the pieces were stored in a school, they slept in the school.

“In Anshun [in Guizhou], for example, the pieces were stored in a cave for protection from air attack. The staff set up an office in Anshun and lived nearby.”

Chiang took with him to Taiwan about 20 per cent of the pieces brought from Beijing, together with the nation’s gold and foreign exchange reserves. Initially, the pieces were kept in storerooms in Wufeng, in the middle of the island. Chiang saw his stay in Taiwan as being temporary, until he “recovered the mainland”. In the 1960s, though, he decided to build a state-of-the-art museum in a northern suburb of Taipei, where the treasures would be easily accessible to visitors. It would become the island’s No 1 tourist attraction.

On November 12, 1965 – what would have been Sun Yat-sen’s 99th birthday – the National Palace Museum opened. It was designed to protect its contents from earthquakes, typhoons, humidity, insects and air raids. The government chose a site at the base of a mountain for security reasons; those items not on display – the vast majority – are stored in a 180-metre-long tunnel blasted out of the mountain, to protect them in the event of air raids.

The history of the Palace Museum has been no less dramatic. In 1958, Beijing’s Cultural Bureau proposed demolishing 70 per cent of the buildings and turning the space into a park; it said that new China did not need relics of a “feudal past”. The central government rejected the proposals.

Another close shave came on August 19, 1966, the day after Mao Zedong and Lin Biao addressed tens of thousands of Red Guards in Tiananmen Square, calling for the destruction of the “four olds” – old customs, old culture, old habits and old ideas. Overlooking the square, the museum was the most conspicuous example.

Fearful of what might happen, then prime minister Zhou Enlai that night ordered the gates to be closed and soldiers to be stationed outside. The next morning, screaming Red Guards demanded entry, but the gates were kept shut.

The museum would not reopen until July 1971, when it allowed a visit by United States national security adviser Henry Kissinger, who was preparing for American president Richard Nixon’s historic 1972 trip to China. Most of the museum staff had been sent to camps in the countryside, where they farmed and studied the works of Mao.

Things have greatly improved for the Palace Museum since. Underground storerooms have been built and widespread renovations carried out. Its problem today is its popularity. In June, a cap of 80,000 visitors a day was imposed; each must show an identity document to enter. To relieve the pressure, work began in November 2013 on another premises, in the Haidian district of Beijing, which will also display items from the Palace Museum collection. Construction is estimated to take seven years, admission will be free and it is expected to attract three million visitors a year.

Last year about 28,000 manuscripts of poems written by the Qianlong Emperor were discovered in a pair of unmarked boxes found at the museum.

“Who knows how many more astonishing secrets are hidden here?” Shan Jixiang, director of the Palace Museum, said to the mainland media. “No other major museum in the world has equal significance to the layout of a city. This is among the world’s top five museums, together with the Louvre, the Metropolitan Museum of Art [in New York], the British Museum [in London] and the Hermitage [in St Petersburg, Russia].

“I can barely take a single day off all year. I have to constantly walk around the palace to scrutinise every corner. As the person in charge of such a museum, with its complex needs, rich history and intense attention from around the world, you cannot expect to sleep well.”

Since Taiwan’s President Ma Ying-jeou assumed office in May 2008, cross-strait relations have improved. As a result, millions of mainlanders visit the National Palace Museum each year and it has taken part in many exchanges with the Beijing museum.

This year, the Taiwan and Beijing museums are hosting dual exhibitions to mark the latter’s 90th anniversary. But, while pieces have gone on loan from Beijing to Taipei, none have travelled the other way. Fung says the museum has no plans to lend pieces to the mainland just yet.

“We should be on an equal footing. We call the Palace Museum by its proper name but they do not recognise our name. The second issue is that China does not provide the legal guarantee,” she says, referring to the promise given by museums in Japan, the US and other countries that any pieces borrowed for exhibitions will not be subject to legal challenge.

“When the Qing government fell, Sun Yat-sen established the Republic of China. It set up the Palace Museum in 1925. In 1948 and 1949, it decided to move some of the pieces to Taiwan. It was legal to do so. No one can challenge this or say that they belong to the People’s Republic of China,” she says, adding that the National Palace Museum has not received any legal challenges from Beijing when its pieces have gone elsewhere in the world, even though some exhibits did arrive later, during the Cultural Revolution.

“The sacking of the Yuanmingyuan [the Old Summer Palace, in Beijing] in 1860 was different. The pieces that were looted then belonged to China,” she says.

The Old Summer Palace was looted and destroyed by British and French troops.

At the end of December, the National Palace Museum will open a branch in Chiayi, in southwest Taiwan. It’s to be called the Museum of Asian Art and Culture and will show not only Chinese art – including some moved from Taipei – but also that from Korea, Japan and other countries. The new museum involves an investment of NT$7.9 billion (HK$1.9 billion) and will include a five-star hotel and tourism facilities.

Like their governments, the two palace museums remain separate and distinct. But they are both proving popular and they both share the beauty, grace and historical glory of the treasures they display.

The Miraculous History of China’s Two Palace Museums (Joint Publishing), by Mark O’Neill, and its Chinese translation, will be published this month.