During the Civil War, he initially served as an aide to Col. Thomas J. Jackson, and was at the First Battle of Bull Run, was in Jackson's Valley Campaign of 1862, the Seven Days Battles, Second Battle of Bull Run, and Battle of Cedar Mountain. He was captured when he slipped into Shepherdstown, West Virginia to see his ailing father. He was taken across the Potomac to General McClellan's headquarters at Keedysville and was later exchanged for a Union officer of equivalent rank held by the Confederates. He returned to Confederate service and was given command of the 33rd Virginia Infantry Regiment, part of the famed Stonewall Brigade. He fought at the Battle of Fredericksburg, and, following health issues, was appointed Colonel on November 12, 1863 on the staff of Gen. Robert Ransom, Jr. in the Richmond defenses, and later in the Shenandoah Valley. He was promoted to Brigadier General on September 23, 1864. and then served with Gen. Rosser in the cavalry in the Valley. In December 1864, he and his wife ran the blockade to Canada on a secret service mission. They remained in Montreal, Lower Canada until the spring of 1866 before returning to Virginia.