 After the Declaration of Chilean Independence in 1810, he adhered to the Patriot side and was commissioned by the first Chilean government to prepare a plan for the defense of the country and oversaw the equipment of the new Chilean Army.At this juncture he trained the first military engineers for the new army.The following year he was called to the defence committee of the new Republic of Chile, and in 1811 was appointed governor of Valparaíso.