Beefeaters, ravens and a gruesome history – no wonder the Tower of London is one of the capital's most iconic buildings, attracting more than two million visitors a year. But its role as a tourist attraction dates only from the Victorian era. Before that, it served as a fortress, a royal residence, a home for the Royal Mint and the Crown Jewels, a storehouse for military paraphernalia and weapons and, of course, a notorious prison.

From the outset, the Tower was designed to invoke fear and awe. Over 27m tall and built from luminous Caen stone, William the Conqueror's White Tower must have looked alien and forbidding to the newly-defeated English – who were forced to build it in the 1070s. William's successors – most notably Henry III and his son Edward I - extended and strengthened the fortress throughout the Medieval period. By 1350 the Tower had taken on the impressive form we know today, complete with daunting defences, royal accommodation, a major branch of the Royal Mint and even an exotic menagerie with lions.

In 1483, 12-year-old Prince Edward and his younger brother Richard - The Princes in the Tower - were imprisoned by their uncle, the Duke of Gloucester (later Richard III). They were never seen again. In the 1930s, two skeletons found buried beneath a staircase in the 1600s were attributed to the - probably murdered - princes.

But it was during the Tudor period that the Tower entered the bloodiest period of its history. Its cells and torture chambers were rarely empty of political and religious prisoners in the aftermath of Henry VIII's revolutionary break from the authority of the Pope in Rome.

Those imprisoned at his Majesty's pleasure included politician Sir Thomas More (1534), Henry's second wife Anne Boleyn (1546), and Protestant reformer Anne Askew (1546). More was beheaded after refusing to accept Henry as head of the new Church of England. Boleyn fell out of favour after failing to produce a male heir and, accused of incest and adultery, was beheaded within the Tower's walls. While the unfortunate Askew was so weak from torture on the rack for failing to implicate Queen Katherine Parr and her ladies as heretics, that she had to be carried in a chair to the stake where she was to be burned.

At almost every stage since in London's history, the Tower has had a starring role. In 1605, it played bleak host to Guy Fawkes after the disastrous plot to blow up Parliament. It was an important pawn in the Civil War. After the Restoration, it became a permanent home to the new Crown Jewels. Even during the two World Wars, the Tower played its part. It survived a direct hit during the Blitz, while the filled-in moat was used for growing fruit and vegetables. Several spies were also held and executed there: in 1941, German Josef Jakobs became the last person to be executed within the Tower's walls.

Today, the prisoners, the mint, the menagerie and the original jewels are all gone. Fortunately, the ravens remain – since legend has it that if they should leave, the Tower and the kingdom will fall…