He later commanded the rear guard during the withdrawal of Confederate forces under the command of General Robert E. Lee from the Battle of Gettysburg in 1863, successfully protecting the 27 miles -long wagon train.