During a moment of great turbulence in the Mexican war of independence, he was named viceroy of New Spain at the beginning of 1816 but he did not take over the office from
Félix María Calleja del Rey until September 20. As a new viceroy Apodaca offered amnesty to the rebels. Thousands of insurgents accepted, with only
Vicente Guerrero in the south and
Guadalupe Victoria and
Nicolás Bravo in
Veracruz remaining in active rebellion. The viceroy also reversed the harsh policies of Calleja and ordered that in no circumstances were rebel prisoners to be summarily shot. He banned the flying of kites (as a safety measure, because they were generally flown from rooftops). He closely reviewed the public accounts, finding that Calleja had kept them accurately and carefully. He paid off the public debt, stopped relying on loans to fund the government, and relied instead only on the customs duties, taxes and other fees due the government. He revived the commercial and mining sectors of the economy, insofar as that was possible in a time of war. On April 17, 1817, Spanish liberal
Francisco Javier Mina and 308 volunteers arrived at
Soto la Marina,
Nuevo Santander, from London and New Orleans. Mina issued a manifesto saying he was not fighting against Spain, but rather against the tyranny of King
Ferdinand VII and to restore the constitutional regime. On May 24 his troops began a march into the interior to join with rebels under
Pedro Moreno at Fuerte del Sombrero, northeast of
Guanajuato. Apodaca sent a strong column against Mina and his allies, under the command of Field Marshal
Pascual Liñán. After active fighting, Liñán killed Moreno and took Mina prisoner at the Rancho del Venadito, near
Silao on October 27. Mina was executed by firing squad on November 11. As the result of this action, the viceroy received the title of
Conde de Venadito, which provoked much ridicule. Once again it looked as though the insurrection might be over. (1834). The United States and Britain, which after the
Napoleonic Wars were no longer war-time allies of Spain, and France were all interested in the commercial advantages they would gain by supporting the rebels in the Spanish possessions. Spanish agents received news that Britons
Thomas Cochrane and Wilson were preparing an expedition against New Spain, and that Mexican insurgents in New York had bought a gunboat, which they based in
Matagorda Bay to attack coastal trading in the Gulf of Mexico. Therefore, Apodaca was given instructions to redouble the vigilance on the coasts. The insurgents managed to capture an armed trading ship from Veracruz and executed the captain. American William Robinson managed to occupy
Altamira and
Tampico, hoping to give new impetus to the revolution, but Robinson was taken prisoner in Tampico and sent to Cádiz. He escaped to Gibraltar, with the assistance of the British. Later, Spain and the United States signed the
Adams-Onís Treaty on February 22, 1819. The treaty established boundaries between the United States and New Spain, which had been in dispute since the
Louisiana Purchase. The U.S. obtained Florida and renounced its claim to Texas. Spain renounced its claim to the
Oregon Country. The previous viceroy, Calleja, had established a fort in the old tobacco warehouse in Mexico City, named
La Ciudadela. Apodaca converted it into a storehouse for arms and munitions, but these were slowly being pilfered. He ordered Brigadier
Francisco Novella to take charge of La Ciudadela and stop the thievery. Novella considered that task beneath his dignity, and was able to enlist the support of the
Audiencia. The incident made Novella an enemy of Ruiz de Apodaca, and it was Novella who later deposed and replaced him in 1821. ==The Plan de Iturbide==