While a University student, the famous "Gray Ghost" of the Confederacy spent several months in the Albemarle County jail in 1852 for the provoked shooting of a fellow University student. In 1861, Mosby enlisted in the Confederate cavalry. He served as a scout for General J.E.B. Stuart, guiding him on his famous ride around McClellan in June of 1862. In 1863 he and nine other men began acting independently as partisan rangers, raiding through Union-held territory in northern Virginia. In May 1863 he crept through Federal lines with a small band of men and captured Union General Edwin H. Stoughton. With a command that eventually numbered about 200, he controlled an area of eastern Virginia known as "Mosby's Confederacy" and continually hindered General U.S. Grant's Wilderness campaign. He also harassed General Philip Sheridan's 1864 Shenandoah Valley campaign, at one point hanging seven randomly selected Union prisoners in retaliation for the execution of seven of his own men. After Lee surrendered he disbanded his rangers and personally surrendered in June.
Shortly after Mosby captured Stoughton, he met General J.E.B. Stuart in Culpeper, Virginia. Impressed with Mosby's daring, Stuart had General Orders printed commending Mosby and gave him a number of copies. The year before his death Mosby presented a copy to his alma mater "as a memento of my affection and as a relic of our war," adding, "In the coming years I hope it may [be] of interest to the Students of the University of Va."