Tegucigalpa was founded by Spanish settlers as the Real Villa de San Miguel de Heredia de Tegucigalpa on September 29, 1578, on the site of an existing native settlement. During the years of independence, the city became widely known as a mining center for silver and gold. The capital of the independent Republic of Honduras was constantly switching back and forth between Tegucigalpa and Comayagua until it was permanently settled in Tegucigalpa in 1880.