The territory of modern Utah has been inhabited by various indigenous groups for thousands of years, including the ancient Puebloans, the Navajo and the Ute. The Spanish were the first Europeans to arrive in the mid-16th century, though the region's difficult geography and climate made it a peripheral part of New Spain and later Mexico. Even while it was part of Mexico, many of Utah's earliest settlers were American, particularly Mormons fleeing marginalization and persecution from the United States. Following the Mexican–American War, it became part of the Utah Territory, which included what is now Colorado and Nevada. Disputes between the dominant Mormon community and the federal government delayed Utah's admission as a state; only after the outlawing of polygamy was it admitted as the 45th, in 1896.