For almost five centuries, the German city of Frankfurt was a city-state within two major Germanic entities:
The Holy Roman Empire as the Free Imperial City of Frankfurt (German: Freie Reichsstadt Frankfurt) (until 1806)
The German Confederation as the Free City of Frankfurt (Freie Stadt Frankfurt) (1815–66)Frankfurt was a major city of the Holy Roman Empire, being the seat of imperial elections since 885 and the city for imperial coronations from 1562 (previously in Free Imperial City of Aachen) until 1792. Frankfurt was declared an Imperial Free City (Freie und Reichsstadt) in 1372, making the city an entity of Imperial immediacy, meaning immediately subordinate to the Holy Roman Emperor and not to a regional ruler or a local nobleman.
Due to its imperial significance, Frankfurt survived mediatisation in 1803. Following the collapse of the Holy Roman Empire in 1806, Frankfurt fell to the rule of Napoleon I, who granted the city to Karl Theodor Anton Maria von Dalberg; the city became known as the Principality of Frankfurt. The Catholic cleric Dalberg emancipated Catholics living with the city boundary. In 1810 Dalberg merged Frankfurt with the Principality of Aschaffenburg, the County of Wetzlar, Fulda, and Hanau to form the Grand Duchy of Frankfurt. After the defeat of Napoleon and the collapse of the Confederation of the Rhine, Frankfurt was returned to its pre-Napoleonic constitution via the Congress of Vienna of 1815 and became a sovereign city-state and a member of the German Confederation.
During the period of the German Confederation, Frankfurt continued to be a major city. The confederation's governing body, the Bundestag (officially called the Bundesversammlung, Federal Assembly) was located in the palace of Thurn und Taxis in Frankfurt's city centre. During the Revolutions of 1848, the Frankfurt Parliament was formed in an attempt to unite the German states in a democratic manner. It was here that Prussian king, Frederick William IV refused the offer of the crown of "Little Germany".
In 1866 the Kingdom of Prussia went to war with the Austrian Empire over Schleswig-Holstein, causing the Austro-Prussian War. Frankfurt, remaining loyal to the German Confederation, did not join with Prussia, but remained neutral. Following Prussia's victory, Frankfurt was annexed by decree of the King of Prussia on 20 September, and became part of the newly formed Province of Hesse-Nassau.