On March 18, 1818, Osorio led a surprise attack on the joint Argentine-Chilean army, which had to retreat to Santiago, with heavy losses. In fact, among the confusion, Supreme Director O'Higgins was thought to be killed, and panic seized the patriot camp. Crippled after his defeat at Cancha Rayada, O'Higgins delegated the command of the troops entirely to San Martín in a meeting on the plains of Maipú. Then, on April 5, 1818, San Martín inflicted a decisive defeat on Osorio in the Battle of Maipú, after which the depleted royalists retreated to Concepcion, never again to launch a major offensive against Santiago.