The royalist army crossed the Desaguadero on 20 June 1811, starting the Battle of Huaqui. The army waited near Huaqui, between the plains of Azapanal and Lake Titicaca. The patriotic left wing, commanded by Diaz Velez, faced the bulk of the royalist forces, while the center was hit by the soldiers of Pio Tristan. Many patriotic soldiers recruited at Upper Peru surrendered or fled, and many of the recruits from La Paz switched sides during the battle. The Saavedrist Juan José Viamonte helped ensure Castelli's defeat by refusing to join the conflict.