Campeche , Campeche San Francisco de Campeche ( ) ( Ahk ' ìin Pech - / aχkʼiːn˥˧ pʰetʃ / in Yucatec Maya ) is the capital city of the Mexican state of Campeche , located at on the shore of the Bay of Campeche of the Gulf of Mexico . The city ' s population at the 2005 census was 211 , 671 people . The municipality for which it serves as the municipal seat had a population of 238 , 850 . The city was founded in 1540 by Spanish conquistador es as San Francisco de Campeche atop the pre - existing Maya city of Canpech or Kimpech . The Pre - Columbian city was described as having 3 , 000 houses and various monuments , of which little trace remains . The city retains many of the old colonial Spanish city walls and fortifications which protected the city ( not always successfully ) from pirates and buccaneer s . The state of preservation and quality of its architecture earned it the status of a UNESCO World Heritage Site in 1999 . Originally , the Spaniards lived inside the walled city , while the natives lived in the surrounding " barrios " of San Francisco , Guadalupe and San Román . These barrios still retain their original churches ; the one in Guadalupe is almost 500 years old . City fortifications . The city of Campeche is an example of urbanism in a baroque colonial city , with a reticular and regular plan , its urban trace , a model of colonial port cities , reflects the main role that it played as a commercial , religious and military connection point characterized by its high level of integrity and homogeneity . More than one thousand buildings with a historic value have survived as witnesses of space and temporal superimposition of several significant historic periods of Mexico . Due to the constant attacks of both English and Dutch buccaneers and pirates such as Francis Drake , John Hawkins , Laurens de Graff , Cornelis Jol , Jacobo Jackson , Jean Lafitte , Francisco de Grammont , Bartolomé Portugués , William Parker , Francisco Nau , Edward Mansvelt , Henry Morgan , Lewis Scot , Roche Braziliano and Michel de Grammont for almost 160 years , in 1686 the government started to fortify the city . The French engineer Louis Bouchard de Becour was commissioned to unify all the defensive works that surrounded the city with a wall . At its completion , the wall surrounding the city of Campeche was 2 , 560 meters in length , forming an irregular hexagon around the main part of the city , with eight defensive bastions on the corners . These bulwarks now serve different functions : It also contained four gates to allow access to the main quarters . The main entrances are the " Puerta de la tierra " ( " Land Gate " ) , built in 1732 , and the " Puerta del mar " ( " Sea Gate " ) . The Land Gate is kept as a tourist attraction , having a light and sound show three nights each week and keeping original supplies and items from the 17th century . The other gates were Guadalupe and San Román , connecting to the outside neighborhoods . Additionally , two main forts protected the city from two nearby hills on each side , the forts of San José el Alto ( built in 1762 ) and San Miguel . These forts gave long - range artillery coverage and served also as look - outs . They were built before the walls of the city . The fort of San Miguel is used as a museum and houses a collection of pre - Hispanic items . The fort of San José houses a collection of boats and weapons of the period . History . Founded in 1540 by Francisco Montejo , Campeche was terrorized by pirates and marauders until the city started fortification in 1686 . San Francisco de Campeche was originally a village , Ah Kim Pech , where the first landed in Mexico in 1517 . The city of Campeche was founded in 1541 and fortified against pirates during the 17th century . It still has the appearance of a fortress . Historical monuments and buildings , such as the Franciscan cathedral , old Maya ruins , and the old city walls and forts , attract many tourists . The fortifications system of Campeche , an eminent example of the military architecture of the 17th and 18th centuries , is part of an overall defensive system set up by the Spanish to protect the ports on the Caribbean Sea from pirate attacks . The state of preservation and quality of its architecture earned it the status of a World Heritage Site in 1999 . Climate . Campeche has a tropical savanna climate , with most rain falling in the wet season from June to October .