He was on frontier, garrison, and engineer duty until 1846, when he participated in the military occupation of the new state of Texas. Subsequently, he served during the Mexican–American War, being brevetted successively to captain and major for gallantry in a number of important battles including the Battle of Palo Alto and the Battle of Resaca de la Palma. He served as chief of staff to Major Folliott T. Lally's column on the march from Vera Cruz to Mexico City in 1847. He joined the Aztec Club of 1847 in 1871.