From a first look at the Topkapi Palace Museum in Istanbul, you might think that the greatest threat to its physical integrity was the sheer volume of tourist traffic tramping through it: 70,000 Turkish and 50,000 foreign visitors a year.

Fat queues stretch around the ornamental park leading up to its stately perch on a cliff looking across the water to Anatolia.

Drawing closer, it turns out that visitors are carefully regulated by turnstiles and metal detectors. The threat comes from elsewhere, and it is one that museums share with businesses and households all over the city.

In 1999 an earthquake killed 20,000 people in nearby towns. The likelihood of another quake hitting Istanbul itself as stress builds along the North Anatolian fault places the Topkapi's delicate treasures in peril -and the staff in a cash-strapped race against time to protect their collection.

In the late 1990s the Topkapi secured sponsorship from Gilan, a local jewellery company, to restore and earthquake-proof the pinnacle of its collection - the 15th-century treasury, which includes a former tepidarium of a Turkish bath.

More than $1m was spent on sprucing the rooms up along with the dormitory building adjoining them - like several of the old display rooms in the palace, the treasury rooms are flanked by the former headquarters of the sultans' own curators, the many servants employed to tend their treasure collections before they came into the hands of the modern Turkish state.

Finished four years ago, the renovation work helped get the Topkapi Palace entered for the European Museum of the Year Award in 2003.

As well as containing some of the most stunning and valuable items in the museum's collection (including the famous Spoonmaker's Diamond and huge knobbly emeralds) the treasury is now by far the most pleasant indoor part of the museum for visitors to walk around.

The marble doorframes are original but the interior of the vaulted ceilings has been replastered, the simple coloured borders of the pointed niches repainted following original designs. The wall lighting is dim and the cream decor new but also subtle, refusing to compete with the treasures.

The gold- and jewel-encrusted thrones, armour, brooches, necklaces and daggers even the gold-clad reliquaries containing bones from John the Baptist's head and forearm, are enclosed in solid iron cases set into the walls, with shatterproof glass that cuts out reflections, allowing a crystal clear view against imperceptible black backdrop.

The cases can withstand a force-nine earthquake. Birgul Ordun, the director's spokesperson, explains that the objects inside them are weighted at key points to hold them still. Fibre-optic lights trained at precise angles pick out the jewels, providing not just perfect illumination of the tiniest diamonds but an enticing sight from a distance for visitors as they arrive.

Friendly staff regulate the entrance to this section of the museum, though the cases are still prone to the inevitable awkward bottlenecks as visitors circulate anti-clockwise and linger before them. Labelling is minimal, limited to one-line descriptions in Turkish and English.

For more background, or for those without a guidebook, an audio-guide company rents handsets at the entrance; otherwise there is a heavy trade in real-live guides.

The museum's harem section is a museum within a museum where queues form to pay a supplement for a guided tour through its two dozen rooms, currently closed for restoration.

Piecemeal renovation goes on continuously at the Topkapi, though rarely on the scale of the earthquake-proofing in the treasury, which was closed in stages for three years.

More of the treasures are hidden away in storage. As part of the earthquake precautions, all hanging artefacts were taken down, leaving just a selection of object highlights that could be safely placed on shelves.

The kitchens need treating to make them earthquake-proof for the benefit of the museum's holdings of porcelain and glass. Without this, only a small number of the thousands of pieces of Japanese and Chinese porcelain are on display, the rest being held in safe storage.

It's a similar story in the treasury - what's on display in the dozen or so cases in each room is a fraction of what could be seen before the earthquake precautions were taken. But this has to be weighed against the advantages of the quality of display in the new cases and the museum's duty to protect the items.

Hulya Tezgan, a textiles curator at the Topkapi, explains that measures have also been taken to protect the objects in her care: the various silver- and gold-thread robes, kaftans and uniforms on display are covered with layers of transparent acetate paper to prevent them from being peppered with small pieces of glass in the event of an earthquake shattering the cabinets.

She says staff members have been provided with printed sets of emergency instructions. But the likely extent of damage to the collections in an earthquake is hard to predict and the ability to store things if the museum is damaged depends on how badly the store rooms themselves are hit.

'We have an emergency plan. [After an earthquake,] we will put the objects in special cases and take them to a safe place. But we don't know what kind of damage there will be,' Tezgan says.

Awareness of the threat is high among staff, and earthquake experts from the Getty in Los Angeles have given seminars on earthquake protection to Istanbul curators.

Although restoration of various buildings of the Topkapi is ongoing, installing earthquake-proof cases for the breakable objects takes renovation to a costly higher level. To renovate the kitchens and provide earthquake proofing for these objects would cost $2m.

A trip across the third courtyard from the treasury to where the holy relics are kept reveals the precarious state of most of the museum's collection.

Crowds throng around wooden cases, their noses almost pressed against the display glass, behind which delicate glass tubes are perched containing hairs from the beard of the Prophet Mohammed, a tooth and even a great framed mud footprint. Although they are accessible and lovingly presented, their ability to withstand a force-nine earthquake seems unlikely.

Next door, in the sultans' portrait gallery which used to house the servants in charge of keeping the relics, waist-high glass cases are screwed by their legs to the floor, enough to protect the painted miniatures and calligraphic scrolls against leaning school kids but no guarantee against a truly elemental force.

Somewhere midway in condition between the spanking new plaster of the treasury and the peeling paint of the portrait room is the partially restored Imperial Council Chamber. Here most of the visitors' attention will be trained on the ceiling, with its ornate paintwork - Islamic in one chamber and European in another.

Bands several inches wide have been left untreated to show the faded state of the paintwork before restoration. Elsewhere, the gold rosettes and bands on the ceilings and pillars of the audience chamber are recently repainted.

The work is carried out by family businesses of expert painters; old men who teach their sons the trade and hold workshops to explain the techniques to students. On a palace of this size, they have their work cut out.

Roland Lloyd Parry is a freelance journalist