Construction of La Cabaña was begun in 1763 by King Carlos III of Spain, the controlling colonial power of Cuba, following the recent capture of Havana by British forces (an exchange was soon made to give Cuba back to the Spanish in exchange for Florida). Realising that the city was not well enough defended and fearing further attacks following British colonial conquests in the Seven Years War they now moved to build a new fortress to boost the defence of Havana. Replacing earlier fortifications next to the 16th century El Morro fortress, La Cabaña was the largest colonial military installation in the New World by the time it was completed in 1774, at great expenses to Spain; so much the King proclaimed it should be visible from Spain having cost so much and take so long to be finished.
The fortress served as both a military base and prison over the next two hundred years for both Spain and an independent Cuba. La Cabaña was used as a military prison during the Batista regime. In January 1959, rebels led by Che Guevara captured La Cabaña and used it as a headquarters and as a military prison for several months while leading the Cuban revolution. During his five-month tenure in that post (January 2 through June 12, 1959), Guevara oversaw the revolutionary tribunals and executions of suspected war criminals, traitors, chivatos (informants), and former members of Batista's secret police. The complex is now part of a historical park, along with El Morro, and houses several museums open to the public. From there, every night a cannon shoot rumbles at 9pm so called "El Cañonazo de las 9", a costume kept from colonial times signaling the closure of the city wall doors.