After being defeated in the rebellion, Caldas, fearing reprisals, escaped to Popayán, but finding that it had been overtaken by the royal troops commanded by future viceroy Juan Sámano, went then to the province of Antioquia. Antioquia had declared independence as the "State of Antioquia" or the "Free and Sovereign State of Antioquia." The Antioquia state had appointed Juan del Corral as a dictator, and del Corral welcomed Caldas and appointed him to create a Military School and as Director of Rifle Factories and General Engineer, as well as giving him the rank of Colonel. As an engineer, Caldas was in charge of erecting buildings, powder mills, and gun factories, as well as coin minting. He also taught in the Academy of Engineers in Medellín, in 1814. Between 1813 and 1814, he took charge of the fortifications along the Cauca River and the installation of a rifle and gunpowder factory. By the end of 1814, Nariño had been defeated and arrested by the Spanish crown, and Bolívar and his army had forced the submission of Cundinamarca to the United Provinces. The federalist General Government, which had been established in Santafé, with growing concerns about the possibility of a Spanish reconquest following the start of Morillo's campaign, then called Caldas to appoint him with the creation of a similar Military School, and to build bridges, trenches, and fortifications around the city. He was sent to the northern army and to fortify roads in Quindío.