Scott's force arrived in the Valley of Mexico in August 1847, by which time Santa Anna had formed an army of approximately 25,000 men. Because Mexico City lacked walls and was essentially indefensible, Santa Anna sought to defeat Scott in a pitched battle, choosing to mount a defense near the Churubusco River, several miles south of the city. The Battle of Contreras began on the afternoon of August 19, when the Mexican army under General Gabriel Valencia attacked and pushed back an American detachment charged with building a road. In the early morning of the following day, an American force led by General Persifor Frazer Smith surprised and decimated Valencia's army. News of the defeat at Contreras caused a panic among the rest of Santa Anna's army, and Scott immediately pressed the attack, beginning the Battle of Churubusco. Despite the strong defense put up by the Saint Patrick's Battalion and some other units, Scott's force quickly defeated the demoralized Mexican army. After the battle, Santa Anna negotiated a truce with Scott, and the Mexican foreign minister notified Trist that they were ready to begin negotiations to end the war.