Q: In this task you will be given a text passage from a trivia quiz. You should choose the category this question belongs to from these categories: History, Science, Social Science, Fine Arts, Literature. You can only choose one category, so if in doubt, please choose the closest match.
Following his resignation due to a failed harvest, the pipiolos and Diego Portales jockeyed for power. Jose Miguel Carrera shifted allegiances to and from this man, and led the aristocratic opposition to his rule. The illegitimate son of the viceroy of Peru, he led the army that was defeated at Rancagua. Later, he was one of two men who led the victory at Chacabuco, along with Jose de San Martin. For 10 points, name this South American revolutionary, who from 1817 to 1823 was the ruler of Chile.
A:
History