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.