The fall of the Holy Roman Empire in 1806 created a power vacuum in Italy, which was filled by Napoleon Bonaparte. Napoleon reorganized Italy into a series of client states, including the Kingdom of Italy. After Napoleon's defeat in 1815, the Congress of Vienna restored the old order in Italy.
However, the desire for Italian unification remained strong. In the 1840s and 1850s, a series of wars were fought between the Italian states and Austria, which was the dominant power in northern Italy. These wars resulted in the unification of much of Italy under the Kingdom of Sardinia-Piedmont.
In 1860, Giuseppe Garibaldi, a nationalist and military leader, led a thousand volunteers on an expedition to conquer the Kingdom of the Two Sicilies. Garibaldi's expedition was successful, and he turned over the conquered territories to King Victor Emmanuel II of Sardinia-Piedmont. This act completed the unification of Italy, and on March 17, 1861, Victor Emmanuel II was proclaimed King of Italy.
The question of where to locate the capital of Italy was debated for several years. Rome was the obvious choice, but it was also the seat of the Papal States, which were ruled by the Pope. The Italian government and the Pope eventually reached an agreement that recognized the sovereignty of the Pope over the Vatican City and made Rome the capital of Italy.
On October 2, 1871, Rome officially became the capital of Italy. The city has remained the capital of Italy to this day.