In 1826 Galindo was appointed by president Sucre to the post of Prefect of the department of Potosi in the newly created republic of Bolivia. This gave Galindo authority over all military and government functions in the area whose mineral wealth had sustained the Spanish empire for over two centuries, and whose remaining mineral resources represented the hope of the new nation. The city of Potosi had been ravaged by all sides during 16 years of the war, and it was Galindo’s job to put it all back together again. This he did with great efficiency and skill by first reorganizing the tax regime imposed on the mining sector, enabling it to recover quickly and generate sufficient revenues for the national treasury to pay the government’s debts and sustain its activities. He restored order in the city by reorganizing the police force and he successfully navigated fraught relations with the Catholic church, negotiating agreements for the reallocation and disposition of church assets. His promotion of secular public education and control of municipal funding assured the survival of Colegio Pichincha, which remains one of the most prestigious educational institutions in the country. He executed the order of the national legislature and successfully minted the country’s first coinage in 1827. He also fell in love, and married Antonia Arguelles the same year. They thereby both became citizens of their adopted country, although Galindo's citizenship had been previously accorded by the Decree of August 12, 1825. In early 1828, due to domestic political opposition to the presence of Colombian forces in the country, and in anticipation of a foreign invasion by Peru, Galindo was hastily appointed Chief of Staff of the Bolivian armed forces and relocated to the city of La Paz in an attempt to organize a defense. But the Bolivian command structure was in disarray, and the invasion forced a change of regime. As a result of the invasion, Sucre was arrested and held by the Peruvian general Agustin Gamarra in the remote village of Siporo until the Treaty of Piquiza was signed on July 6, 1828. Under the terms of the treaty, Galindo led his troops into exile in Argentina and Sucre left Bolivia the following month.