The Real Felipe Fortress was built to defend the main Peruvian port and the city of Lima from pirates and corsairs during colonial times. The fortress was pivotal in the 1866 naval battle between a Spanish fleet sent to South America to "reclaim" its colonies and land batteries in the coast of Peru. The Real Felipe Fortress is currently the Peruvian Army Museum, displaying historical uniforms, weapons and other military paraphernalia.
Originally, the city of Lima, capital of the Viceroyalty of Peru, was protected by a surrounding wall. However, an earthquake that destroyed many parts of the wall in 1746 convinced the Viceroy José Antonio Manso de Velasco, Count of Superunda, that building a fortress in the port of Callao was the only solution to keep Lima safe. The name Real Felipe was chosen to honor the king Philip V of Spain. The fortress was designed by the French architect and mathematician Louis Godin. The construction started on January 21, 1747 and is considered to be one of the biggest fortifications built by Spain. It was completed after 30 years under the supervision of the Viceroy Manuel de Amat y Juniet in 1774. For the next four decades fortress saw little action and was first used to contain the rebellions seeking the Independence of Peru. (See Peruvian War of Independence.) The fort was also the last place the Spanish held on the South American mainland. General José Ramón Rodil y Campillo held out there until January 23, 1826, fourteen months after the Battle of Ayacucho.