During the 19th century, Mexico City was the center stage of all the political disputes of the country. It was the imperial capital on two occasions (1821–1823 and 1864–1867), and of two federalist states and two centralist states that followed innumerable coups d'états in the space of half a century before the triumph of the Liberals after the Reform War. It was also the objective of one of the two French invasions to Mexico (1861–1867), and occupied for a year by American troops in the framework of the Mexican–American War (1847–1848).