The Free State of Bavaria is a state of Germany, located in the southeast. With an area of 70,548 square kilometres, it is the largest state by area, forming almost 20% of the total land area of Germany. Bavaria is Germany's second most populous state, with 12.5 million inhabitants. Bavaria's capital and largest city is Munich, the third largest city in Germany. One of the oldest states of Europe, it was established as a duchy in the mid first millennium. In the 17th century, the Duke of Bavaria became a Prince-elector of the Holy Roman Empire of the German Nation. The Kingdom of Bavaria existed from 1806 to 1918, and Bavaria has since been a free state. Modern Bavaria also includes parts of the historical regions of Franconia, Upper Palatinate and Swabia.