Second Battle of Cancha Rayada The Second Battle of Cancha Rayada ( March 16 , 1818 ) , ( also known as the Surprise of Cancha Rayada ) was fought in Chile between South American patriots and Spanish royalists , during the South American wars of independence . The result was a defeat for the rebels , who took their revenge at the Battle of Maipú . Background . In March 1818 , the royalist forces concentrated and fortified in Talca with around five thousand men under Brigadier Mariano Osorio , while the independentist forces of around seven thousand men formed by the Army of the Andes were taking positions at the Cancha Rayada plain s , about seven kilometers away . General José de San Martín , fearing an attack on his flank , ordered a change of position of the troops . Knowing their disadvantage in number and cavalry , the Spanish General Osorio was not eager to engage in battle either , remaining content with fortifying Talca . However , after a suggestion from Colonel José Ordóñez a confrontation was decided upon , under Ordoñez ' command . The battle . The Spanish attacked at 19 : 30 , when the last thing the patriots expected was a battle . In a bold move , Ordoñez made the kind of attack San Martín had most feared : circumventing the city and making a surprise attack at night behind the vanguard where the patriot forces were still taking positions . The surprise attack happened before the patriot army had re - positioned itself , and was a directed at the battalion under General Bernardo O ' Higgins command , near San Martín ' s position . Soon , the vanguard soldiers dispersed , leaving O ' Higgins in a bad position ; his horse was shot dead and he was wounded in one arm . In an uncharacteristic move , instead of ordering retreat San Martín held the position , which made more patriot soldiers flee under enemy fire , leaving their weapons and supplies behind . After the initial disorder , however , he ordered retreat . The rear and reserves had already re - positioned , somewhat withstanding the attack , but had no - one in command , since their chief , Colonel Hilarión de la Quintana , had left for headquarters to receive orders after the re - position and had not yet returned . Colonel Juan Gregorio de Las Heras took command , and led the men during the retreat , while trying to recover as much artillery and weapons as possible . San Martín and O ' Higgins ( who were also retreating at full speed ) were being closely chased by royalist forces . Aftermath . By March 21 , the decimated patriot forces of around three and half thousand men reunited in San Fernando , while news of the defeat reached Santiago . Rumors of deaths of O ' Higgins and San Martín were spreading , and an exodus from Santiago to Mendoza began . Regarding the battle , San Martín sent the following message : " Camping the army under my command in the outskirts of Talca , it was attacked by the enemy , and suffered an almost generalized disbanding which forced me to retreat . I ' m reuniting the troops right now , with happy results , as I ' m already counting 4 , 000 men from Curicó to Pelequén " . The battle ( which was the only defeat the campaign had suffered ) resulted in around 150 killed , and two hundred taken prisoner . Several hundred had deserted , the whole artillery of the Argentine side was lost along with considerable numbers of horses , mules , and weapons from both the Chilean and Argentine parts of the army . Despite the royalist victory , the action proved decimating to their side : two hundred soldiers had been killed , three hundred men captured and around six hundred had deserted , a total comprising more than half the two thousand men that had charged into the battle .