Cobija was the first significant Pacific Ocean port of independent Bolivia. In 1825, it was the main port of Bolivia due to the Potosí silver mine. The city was destroyed by an earthquake in 1865, but it was revived with the discovery of ore in Caracoles. At the end of the War of the Pacific, the city and the entire coastal province of Bolivia was annexed by Chile. In a treaty signed in 1904 Bolivia recognised the loss of Cobija. Eventually, Cobija was replaced by the port at Antofagasta and in 1907 it was abandoned and its parish was moved to the town of Gatico which is itself now nearly a ruin .