He immediately began his military service in the Mexican–American War. During that war, he was brevetted captain for his performance in the battles of Contreras and Churubusco and was promoted to first lieutenant six days later. After returning to the United States following the war, he became an assistant professor of drawing at West Point from 1850 to 1853 and fought against the Seminoles in Florida from 1856 to 1858. He was promoted to captain on November 22, 1860.