The core of the Maya civilization, which extended across Mesoamerica, was historically based in the territory of modern Guatemala. In the 16th century, most of this area was conquered by the Spanish and claimed as part of the viceroyalty of New Spain. Guatemala attained independence in 1821 from Spain and Mexico. In 1823 Guatemala became part of the Federal Republic of Central America, which dissolved by 1841.