Rome built a legionary camp here around AD 97 and called it Vindobona, a Celtic name. At its height it held some 15,000 people, and Marcus Aurelius may have died here in 180. The camp's core lay under today's Hoher Markt, where you can still see its excavated foundations. The German name Wien has nothing to do with Vindobona: it comes from the river, and first turns up in 881 as Wenia.
The Babenberg dukes moved their residence here from Klosterneuburg in 1155, the year the Schottenstift was founded for a community of Irish monks. Vienna got city rights in 1221, and Duke Rudolph IV founded the university in 1365, the oldest in the German-speaking world. The Habsburgs, who followed the Babenbergs, made Vienna the seat of the Holy Roman Emperors in the 16th century, and it kept that role until the empire was dissolved in 1806.
Ottoman armies besieged the city in 1529 and again in 1683. After the first siege it was rebuilt as a fortress with eleven bastions and a moat, ringed by an open field of fire called the glacis. Those walls held for two months in 1683 until an army under the Polish king John III Sobieski broke the siege. Afterwards the nobility filled the suburbs with Baroque garden palaces such as Schönbrunn and the Belvedere, with Fischer von Erlach and Hildebrandt the leading architects.
Napoleon's troops took Vienna twice, in 1805 and 1809. After his fall, the Congress of Vienna redrew the map of Europe in 1814 and 1815. It was said at the time that the congress danced but made no progress. In 1858 the old walls were torn down and the Ringstrasse laid out in their place. Its parade of monumental buildings still defines the city's look, and by 1910 the population had reached 2,031,000.
Around 1900 the city was a laboratory of modern ideas: Otto Wagner and the Secession artists, the plain buildings of Adolf Loos, and Freud's psychoanalysis. After the empire fell in 1918, the Social Democrats won the city in 1919 and began the experiment known as Red Vienna. Between 1925 and 1934 they built over 60,000 council flats, and the city still houses about a third of its residents this way. In 1934 the army shelled one of those estates, the Karl-Marx-Hof, to end a civil war.
On 15 March 1938 Hitler spoke to a crowd of 200,000 on Heldenplatz and announced that Austria would be folded into Nazi Germany. Of the nearly 200,000 Jews living in Vienna, about 120,000 were forced to emigrate and some 65,000 were murdered. Of 24 synagogues, only the Stadttempel survived. Allied bombing later destroyed around a third of the centre and set the State Opera and the Burgtheater on fire.
For ten years after the war the city was split between the US, Britain, France and the Soviet Union, and policed by four soldiers in one jeep. That spy-ridden decade is the backdrop of The Third Man, with its zither score by Anton Karas. The State Treaty of 1955 ended the occupation and Austria declared itself neutral. The Opera and Burgtheater reopened that year. In the 1970s Vienna became the third seat of the United Nations, and it has since got back much of its old weight as a meeting place between East and West.