When the French intervention in Mexico began in 1862, Cortina sided with Juárez at first, and took part in the Battle of Puebla on May 5. However, as the French eventually defeated the Mexican forces led by the Gen. Ignacio Zaragoza and succeeded in establishing Archduke Maximilian of Habsburg as Maximilian I, sovereign of Mexico, Cortina sensed the opportunity to consolidate his power in the Tamaulipas region and switched sides by joining the invaders. This alliance was short-lived, and soon Cortina rose against the French. Commanding a large army that he had personally gathered and equipped, he engaged the interventionist forces that had landed near Tampico and defeated them. His further military actions along Central Mexico helped in the effort against the invasion, and he was present at the execution of Maximilian in Querétaro (June 1867). During this time, in the absence of a legal national authority, he appointed himself Governor of Tamaulipas twice - in 1864 and in 1865. He resigned from the office in 1866 in favor of Generals José María Carvajal and Santiago Tapia.