In 1854 president Antonio López de Santa Anna enlarged the area of the Federal District almost eightfold from the original 220 to 1,700 km2 (80 to 660 sq mi), annexing the rural and mountainous areas to secure the strategic mountain passes to the south and southwest to protect the city in event of a foreign invasion. (The Mexican–American War had just been fought.) The last changes to the limits of the Federal District were made between 1898 and 1902, reducing the area to the current 1,479 km2 (571 sq mi) by adjusting the southern border with the state of Morelos. By that time, the total number of municipalities within the Federal District was twenty-two.