Once a Maya trading village called Ah Kim Pech (Lord Sun Sheep-Tick), Campeche was first briefly approached by the Spaniards in 1517. Resistance by the Maya prevented the Spaniards from fully conquering the region for nearly a quarter-century. Colonial Campeche was founded in 1531, but later abandoned due to Maya hostility. By 1540, however, the conquistadors had gained sufficient control, under the leadership of Francisco de Montejo (the Younger), to found a permanent settlement. They named the settlement Villa de San Francisco de Campeche.
The settlement soon flourished as the major port of the Yucatán Peninsula, but this made it subject to pirate attacks. After a particularly appalling attack in 1663 left the city in ruins, the king of Spain ordered construction of Campeche’s famous bastions, putting an end to the periodic carnage.
Today the economy of the city is largely driven by tourism.