In 1866, Díaz formally declared loyalty. That same year, he earned victories in Nochixtlán, Miahuatlán, and La Carbonera, and once again captured Oaxaca destroying most French gains in the south of the country. He was then promoted to general. Also in 1866, Marshal Bazaine, commander of the Imperial forces, offered to surrender Mexico City to Díaz if he withdrew support of Juárez. Díaz declined the offer. In 1867, Emperor Maximilian offered Díaz the command of the army and the imperial rendition to the liberal cause. Díaz refused both. Finally, on 2 April 1867, he went on to win the final battle for Puebla. By the end of the war, he was hailed as a national hero.