in February 1844. Mexican-American War During the Mexican–American War, as colonel of the 2nd U.S. Infantry, Riley fought at the Siege of Veracruz and the Battle of Cerro Gordo, where he was cited for bravery. He was brevetted brigadier general and assumed command of the 2nd Brigade in David E. Twiggs's Second Division. He led his brigade at the Battle of Contreras and the Battle of Churubusco, where Winfield Scott gave him credit for the U.S. victory: Riley had discovered a way around the rear of Velencia's position. He was appointed brevet major general and fought at the Chapultepec. After the battle at Churubusco, he also presided over the courts-martial of 72 deserters of the so-called Saint Patrick's Battalion discovered hiding in the San Patricios convent; among them were John Murphy and John Riley. He was generally considered one of the ablest brigade commanders in the army during the war with Mexico. Role in California statehood After the war with Mexico, Riley served a brief stint at Fort Hamilton, in Brooklyn, New York, in 1848. In the years 1849 and 1850, General Riley commanded the Military Department in Upper California and exercised the duties of Provincial Governor: the inaction of Congress in deciding the issue of California statehood complicated his service. He relieved Colonel Richard B. Mason on 13 April 1849, as the Gold Rush worked into its most violent phase. In addition to the influx of prospectors seeking their fortunes, daily desertions of his own men rapidly depleted his troops. At the height of the Gold Rush, he had eight companies of infantry, two artillery, and two dragoons stretched between San Diego and San Francisco. When Congress refused to act on the statehood of California and New Mexico, he called for the election of civil officers to a de facto government. Consequently, the military authorities could not prevent the slaughter of California's native population, nor could they suppress the violence in the lawless gold camps. He relinquished all his civil power on 20 December 1849. After his administrative service concluded on the Pacific, Riley was ordered to take command of a regiment on the Rio Grande. However ill-health prevented further service on his part. He returned to his home in Black Rock, near Buffalo, New York, where he died of cancer. General Riley died on Thursday evening, 10 June 1853, survived by his wife Arabella (who died on 12