Black, red and gold all featured previously in German history. Red was the colour of the Hanseatic cities, black and gold those of the Holy Roman Empire. But, it was only during the nineteenth century that they were combined in one flag.
The combination emerged at the Battle of Leipzig in 1813 – Napoleon's first major defeat in battle, and the moment which the German speaking world has always seen as its liberation from French occupation.
Uniforms worn by a Prussian brigade, the Lützow Free Corps, were black, red and gold for purely practical reasons. But the Corps represented German unity, because it drew its recruits from the wider German-speaking world.
In the aftermath of the victory the colours began to symbolize liberation from Napoleon and a desire for German unity.
In 1815 the German Confederation was created. It was a replacement of sorts for the Holy Roman Empire that united the various different German speaking states.
The next 30 years or so were dominated by the question of German unity and the colours became an important part of the push for a German nation.
The Hambacher Fest of 1832, a gathering in support of liberalism and nationalism, and against conservatism and censorship, adopted the tricolour of black, red and gold as symbolic of these values.
On March 9th 1848, the Federal Convention declared black, red and gold as the national colours. Today the flag's link to the German nation is not in doubt – especially after its prevalence at historic events such as German reunification in 1990.
But when the revolution collapsed in 1850, the tricolour also failed and was replaced by a black, white and red flag. These colours symbolized the North German Federation, and were adopted by Bismarck during German unification in 1871.
It was not until 1919 that black, red and gold were readopted as the national flag. The constitution of the Weimar Republic wanted to reference the anti-autocratic movement of the 19th century and embrace values of democracy, republicanism and liberalism in a new era.
The three main parties of the period, the Social Democratic Party, the Centre Party (precursor to the modern day Christian Democratic Union), and the Democratic Party formed an organisation called the Black, Red, Gold Banner of the Reich.
This shows the importance of the colours as a symbol of parliamentary democracy but also of resistance to political extremism.
In contrast the black, white and red colours then began to symbolize the values of imperialism and nationalism that the Weimar Republic rejected. This is why right-wing groups and eventually the Nazis used these colours to oppose the Weimar Republic and call for a return to the period of the German Reich.
After the horrors of the Third Reich which adopted black, red and white as its colours along with the swastika symbol, the black, red and gold flag has been used throughout the post-war period.
Because of the ban on Nazi symbols in Germany, right wing and neo-Nazi groups have adopted the black, white, and red tricolour as their flag.
Even the GDR used the black,red and gold tricolour, just adding a coat of arms to their version of the flag.