Inhabited by indigenous peoples of the Americas for many centuries before European exploration, New Mexico was subsequently part of the Imperial Spanish viceroyalty of New Spain. Later, it was part of Mexico before becoming a U.S. territory and eventually a U.S. state.