As the troops moved from Frederick, Maryland, toward Gettysburg, Pennsylvania, the regiment in the rear was surprise attacked by part of a large cavalry force under the command of General James Ewell Brown "Jeb" Stuart.