Panamá Viejo is the remaining part of the old Panama City and former capital of the country. It is located in the suburbs of the modern city. Together with the historical district of Panamá, it forms a World Heritage Site. The city was founded 15 August 1519 by Pedro Arias Dávila and other 100 inhabitants; at the time, it was the first permanent settlement on the Pacific Ocean, substituting the two cities of Santa María la Antigüa del Darién and Acla. Two years later, in 1521, the settlement was promoted to the status of city by a royal decree and was given a coat of arms by Charles V of Spain, forming a new cabildo. Shortly after its creation the city became a starting point for various expeditions in Peru and an important base where gold and silver were sent to Spain.
In 1539 and 1563, the city suffered a number of fires which destroyed parts of it but did not impede the city's development. In 1610, the city reached a population of 5000, with 500 houses and convents, chapels, a hospital and the cathedral. At the beginning of the 17th century, the city was attacked several times by pirates and indigenous people from Darién. On 2 May 1620, an earthquake damaged many buildings in the city. On 21 February 1644, the Great Fire destroyed 83 religious buildings, including the cathedral. At this time, there were 8,000 people living in the city.
In 1670, the city counted 10,000 inhabitants. On 28 January 1671, the Welsh privateer Henry Morgan attacked the city with 1,400 men marching from the Caribbean coast across the jungle. Morgan's force defeated the city's militia then proceeded to sack Panamá. Either Morgan and his army started a fire that burned the city or the Captain General Don Juan Pérez de Guzmán ordered the gunpowder magazines exploded. Either way, the resulting fire destroyed the city.
Morgan's attack caused the loss of thousands of lives and Panamá had to be rebuilt a few kilometres to the west on a new site (the current one). Because the sacking of Panamá violated a new peace treaty between England and Spain, Morgan was arrested and conducted to England in 1672. He proved he had no knowledge of the treaty. Instead of punishment, Morgan was knighted by King Charles II of England in 1674 before returning to Jamaica the following year to take up the post of Lieutenant Governor.