The first cathedral was built in 1541 on the site of the present Templo de Santa Maria de Gracia. This primitive church was built with adobe and a thatched roof. On May 30, 1574, during Mass, neighbors fired shots into the air. Some of these fell onto the church and caught fire, severely damaging the church. Work began on a new cathedral designed by master architect Martin Casillas, but progressed slowly because of scarce funds. The new cathedral was completed in February 1618. Finally in April of that year, the blessed sacrament was moved from the former church to the new one. In 1818, an earthquake shook the city, causing the towers and the dome to collapse. These were replaced, but the new structures were destroyed by a subsequent earthquake in 1849. The new towers were designed by architect Manuel Gomez Ibarra. Construction took three years and cost 33,521 pesos. The new structures were completed in 1854. Pope Pius XII elevated the cathedral to the rank of minor basilica.