In 1877, at the end of the second Anglo-Asante War, Accra replaced Cape Coast as the capital of the British Gold Coast colony. After a railroad was built between Accra and the inland locations of mines and farms, Accra became the economic center of Ghana. Large areas of the city were destroyed by earthquakes in 1862 and 1939, but the city rebuilt around a seaport and later a brewery. Each time it rebuilt, the city was made larger.