 In 1821, Mexico gained its independence from Spain.Alta California became a territory rather than a full state.The territorial capital remained in Monterey, California, with a governor as executive official.