The recorded history of Luxembourg begins with the acquisition of Lucilinburhuc (today Luxembourg Castle) situated on the Bock rock by Siegfried, Count of Ardennes, in 963 through an exchange act with St. Maximin's Abbey, Trier. Around this fort, a town gradually developed, which became the centre of a state of great strategic value.
In the 14th and early 15th centuries, three members of the House of Luxembourg reigned as Holy Roman Emperors. In 1437, the House of Luxembourg suffered a succession crisis, precipitated by the lack of a male heir to assume the throne, which led to the territories being sold by Duchess Elisabeth to Philip the Good of Burgundy.
In the following centuries, Luxembourg's fortress was steadily enlarged and strengthened by its successive occupants, the Bourbons, Habsburgs, Hohenzollerns and the French.
After the defeat of Napoleon in 1815, Luxembourg was disputed between Prussia and the Netherlands. The Congress of Vienna formed Luxembourg as a Grand Duchy within the German Confederation. The Dutch king became, in personal union, the grand duke. Although he was supposed to reign the grand duchy as an independent country with an administration of its own, in reality he treated it similarly to a Dutch province. The Fortress of Luxembourg was manned by Prussian troops for the German Confederation. This arrangement was revised by the 1839 First Treaty of London, from which date Luxembourg's full independence is reckoned.
At the time of the Belgian Revolution of 1830–1839, and by the 1839 Treaty establishing full independence, Luxembourg's territory was reduced by more than half, as the predominantly francophone western part of the country was transferred to Belgium. In 1842 Luxembourg joined the German Customs Union (Zollverein). This resulted in the opening of the German market, the development of Luxembourg's steel industry, and expansion of Luxembourg's railway network from 1855 to 1875, particularly the construction of the Luxembourg-Thionville railway line, with connections from there to the European industrial regions. While Prussian troops still manned the fortress, in 1861, the Passerelle was opened, the first road bridge spanning the Pétrusse river valley, connecting the Ville Haute and the main fortification on the Bock with Luxembourg railway station, opened in 1859, on the then fortified Bourbon plateau to the south.
After the Luxembourg Crisis of 1866 nearly led to war between Prussia and France, the Grand Duchy's independence and neutrality were again affirmed by the 1867 Second Treaty of London, Prussia's troops were withdrawn from the Fortress of Luxembourg, and its Bock and surrounding fortifications were dismantled.
The King of the Netherlands remained Head of State as Grand Duke of Luxembourg, maintaining a personal union between the two countries until 1890. At the death of William III, the throne of the Netherlands passed to his daughter Wilhelmina, while Luxembourg (then restricted to male heirs by the Nassau Family Pact) passed to Adolph of Nassau-Weilburg.
At the time of the Franco-Prussian war in 1870, despite allegations about French use of the Luxembourg railways for passing soldiers from Metz (then part of France) through the Duchy, and for forwarding provisions to Thionville, Luxembourg's neutrality was respected by Germany, and neither France nor Germany invaded the country. But in 1871, as a result of Germany's victory over France, Luxembourg's boundary with Lorraine, containing Metz and Thionville, changed from being a frontier with a part of France to a frontier with territory annexed to the German Empire as Alsace-Lorraine under the Treaty of Frankfurt. This allowed Germany the military advantage of controlling and expanding the railways there.
In August 1914, Imperial Germany violated Luxembourg's neutrality in the war by invading it in the war against France. This allowed Germany to use the railway lines, while at the same time denying them to France. Nevertheless, despite the German occupation, Luxembourg was allowed to maintain much of its independence and political mechanisms.
In 1940, after the outbreak of World War II, Luxembourg's neutrality was again violated when the Wehrmacht of Nazi Germany entered the country, "entirely without justification". In contrast to the First World War, under the German occupation of Luxembourg during World War II, the country was treated as German territory and informally annexed to the adjacent province of the Third Reich. A government in exile based in London supported the Allies, sending a small group of volunteers who participated in the Normandy invasion. Luxembourg was liberated in September 1944, and became a founding member of the United Nations in 1945. Luxembourg's neutral status under the constitution formally ended in 1948, and in 1949 it became a founding member of NATO.
In 1951, Luxembourg became one of the six founding countries of the European Coal and Steel Community, which in 1957 would become the European Economic Community and in 1993 the European Union. In 1999 Luxembourg joined the Eurozone. In 2005, a referendum on the EU treaty establishing a constitution for Europe was held.