In early 1817, San Martín led the crossing of the Andes into Chile, obtaining a decisive victory at the battle of Chacabuco on February 17, 1817, and took Santiago de Chile, where he refused the offer of the governorship of Chile in favour of Bernardo O'Higgins (who became supreme director) because he did not wish to be diverted from his main objective, the capture of Lima.