Everyone has some idea of what the Kremlin is. The red stars and the ring of Gothic-looking walls and towers have represented Russia and its government so many times that they are like a trademark.

Today, it is the flag of the Russian Federation that flutters from a handsome cupola inside the walls; the implication is that Putin's Russia is as mighty and immutable as any historic empire. But that is not the only message written in the stone and brick. The secret is to look behind the dazzling facades.

In the eight centuries of its existence, the Kremlin has been used to symbolise everything from Soviet dictatorship and proletarian revolution to imperial tsarism and even an inscrutable theocracy. The palaces are opulent, but there is menace here, as well as power. In 1839, a celebrated French traveller called the Marquis de Custine described the fortress as a "satanic monument", "a habitation that would suit some of the personages of the Apocalypse". "Like the bones of certain gigantic animals," he concluded, "the Kremlin proves to us the history of a world of which we might doubt until after seeing the remains."

Download the new Independent Premium app Sharing the full story, not just the headlines

But there is far more to the Kremlin than a pile of ancient bones. Its timelessness is the result of careful image-management. Parts of the citadel are truly old, including its most sacred building, the Cathedral of the Dormition whose structure was completed in 1479. The paved square around this is the focus of most guided tours, and it includes two other cathedrals, a 16th-century belltower and a palace that looks like a giant jewel-box.

If you stand here for long enough, you might imagine golden-robed boyars, but the present setting would have been entirely alien to them. Today's Kremlin is Stalin's creation, an expurgated version of a mid-19th-century complex that was in turn unrecognisably transformed after Napoleon abandoned it in 1812. And there had been innumerable programmes of rebuilding before that. The Kremlin may well be a perfect symbol of the Russian past, but what it embodies is not some romance of eternity, but disinformation, upheaval and loss.

Founded in the 12th century, the fortress started life as a collection of timber palaces and churches on a hill between two riverbanks. Its main defence back then was not its ugly, clay-smeared wooden walls but its remote location in the heart of dense and uninviting virgin forest.

The place came close to ruin many times. But Moscow's princes always managed to survive, they kept their Mongol overlords on side, and their victories over neighbours, cousins and overmighty courtiers were rewarded with a steady flow of cash and manpower. By the time the Mongol empire started to unravel in the 15th century, Moscow's citadel was home to the region's dominant military power.

The Kremlin of the guidebooks dates from this moment. It was built on the orders of Ivan III, a prince whose calculating use of sovereignty exceeded even 15th-century European standards. When he turned his mind to a new fortress, Ivan did not rely on the skills of local men. The future symbol of Russian statehood was designed by Italian contemporaries of Leonardo da Vinci, including a Milanese straight from the Sforza court and an architect from Bologna who doubled as cannon-founder, mint-master and all-purpose magician.

In 50 years, beginning in the 1470s, these foreigners transformed Ivan's shabby-looking citadel into an architectural classic. They began with the Dormition Cathedral. This had to be designed in conformity with the precepts of Orthodox faith, cupolas and all, but the fortress walls that rose around it could have graced Lombard Verona, and while one set of Italians was adding fashionable swallowtail battlements to those, others worked on Ivan's palaces, a series of low buildings linked by raised walkways. The place must once have felt like an expensive maze.

Italians designed the core and walls of the Kremlin, then, but the towers were not completed until later. No one can be sure – the crucial documents are lost – but the author of the famous Saviour Tower (the one with the clock) was probably British. At the turn of the 17th century, Russia tore itself apart. The Kremlin was occupied by a rabble of foreign troops, though the locals also did their bit in burning, looting and reducing the old place to semi-ruin. Rats colonised the golden palaces, and as the garrison ran out of crows to eat they started harvesting unwary Muscovites.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

A new dynasty (the Romanovs) was finally installed, but after such prolonged horror, its hold on power was tenuous. As usual, some opposition could be neutralised by the judicious use of torture, but what was really needed was a sense that Russia and the Romanovs were set on a predestined and Heaven-blessed course. The Kremlin, now a bloodstained wreck, was to serve again as throne room, altar and stronghold, but for that it needed to look grand. The tsar appealed to James I, and craftsmen from the British Isles set out for Russia. We may never know who created the gabled tower that proclaimed the new dynasty, but its clock was certainly designed by a Scot.

With so much foreign craftsmanship on prominent display, a visitor in search of truly Russian portions of the Kremlin will find relatively little. True, there used to be important medieval churches on the site, and there were two entire monastery complexes, but Stalin had the lot blown up in 1929 as part of a campaign against religion. The Grand Kremlin Palace, built for Nicholas I in the 1840s, was the work of a Russian architect, as was the Armoury Chamber next to it (where the museum of Russia's imperial treasures is still housed).

These vast, uncompromising structures dominate the south-west corner of the Kremlin now, but they are hardly charismatic. At the time of their construction, indeed, a visitor from London decided that the giant palace was "more like a Manchester cotton-factory than the Imperial residence of the sacred Kremlin". That leaves the Senate building, whose dome is visible above Red Square, but no mere tourist ever gets to visit that. This neo-classical masterpiece, designed in the 1770s and famous for its statues, oval halls, and breathtaking internal courtyard, is known today as the Presidential Building. In Stalin's time, it was called Kremlin Corpus No 1. Either way, it belongs to the political elite.

The Kremlin specialises in the tantalising scent of power. If you stand on Red Square and look at the Nikolsky Tower, you will see the window of Stalin's office in the corner of the Senate Building just behind the battlements. If you buy a ticket for the citadel and walk in through the Trinity Gate, the line of yellow buildings on your right includes Lenin's original apartment and, beyond it, the building where Stalin lived until his wife Nadezhda shot herself (on the third floor). In those days, the buildings all around were crammed with people, including palace staff from tsarist times as well as all the nannies, maids and chauffeurs that the Bolshevik elite hired for itself. There was a hairdresser on the ground floor of Lenin's former block, and a canteen in an annex.

The slick appearance of the tourist sites gives no hint of the obsessive security that began in those times. Every room was bugged, every inmate followed. Unseen eyes watched the gates, but they also monitored the surrounding roads, which soon began to seem as fearsome as the fort itself. The Ninth Department of Russia's secret police managed the Kremlin. It was a good job for an officer to have (you got a fast car and a phone that worked), but life-expectancy was relatively low. This was a regime that devoured itself; the slightest crisis could provoke a cull of loyal servants. The secret policemen were watched by spies of Stalin's own, and there were other watchers in the shadows always watching them. Every leader valued compromising information about his rivals – the Kremlin's offices were riddled with false walls and hidden safes stuffed with manilla files.

These stories help create a special Kremlin atmosphere, one that Vladimir Putin has been careful to exploit. Russia is no longer the world's second superpower, but anyone who wants to see its President must contend with the Kremlin ghosts. You may be an ambassador, you may be the US Secretary of State, but you will still be forced to walk for miles along a maze of mirrored corridors and wait in overheated, interlinking halls.

It was the interpreter who worked with John Major and Tony Blair who reminded me that "people went into some of those buildings and came out blinded".

At Kremlin summits, Russia's history is like an extra presence, and it would be a brave soul who did not shudder at the idea of what might yet be waiting in the silent, empty rooms. For Russians, however, the grandeur provides an illusion of continuity that helps to compensate for the uncertainties of real life. There was a scandal, in the Yeltsin years, about the huge cost of restoring it, but now the Kremlin is a source of unreflective patriotic pride. When people think of Putin working at his desk, they picture the tricolour Russian flag, the antique desk, a chandelier. Few know about the private gym, let alone the concealed lavatory in the panelling.

But illusion is what the Kremlin still does best. As in the past, when newly-minted tsars and commissars were glad to borrow its charisma, the fortress has been changed to help project its current masters' favoured messages. A site that once accommodated a set of toilets and a dining-hall, for instance, was cleared in Boris Yeltsin's first term for the rebuilding of the Red Staircase, the canopied steps from which the tsars had once descended from their palace. The idea was to show the world that Russia was being reborn, a fit home for its ancient saints after decades of Communism. "How sad, really," Yeltsin confided to his diary, "that we have lost the … sense of wholeness and continuity of our history. How desirable it would have been to have all of this restored in our country."

The latest attempt to project that wholeness is the restoration, to a suspiciously crisp perfection, of two icons on the Kremlin gatehouses. In a land where power has been anything but continuous, where not just icons but whole churches (and whole populations) have been wiped out on the whim of unelected governments, these images are fascinating. In Russia, their bright paint attests, a sense of timeless continuity is something that the Kremlin's masters can still organise more or less overnight.

Catherine Merridale's 'Red Fortress: The Secret Heart of Russia's History' is out now (£30, Allen Lane)