On 12 September 1863 in San Luis Potosí, Lerdo de Tejada was named minister of foreign affairs, of the interior and of justice in Juárez's cabinet. He held these posts until 17 January 1871, 14 January 1868 and 11 September 1863, respectively. Throughout the French occupation and Maximilian's Second Empire, Lerdo de Tejada was President Juárez's closest ally and confident. On 8 November 1865, he signed the decree extending Juárez's term until the end of the war. In doing so, he opposed the claims of General Jesús González Ortega, who wished to succeed Juárez.