The Battle of Middleburg took place from June 17 to June 19, 1863, in Loudoun County, Virginia, as part of the Gettysburg Campaign of the American Civil War.
 Confederate Maj. Gen. J.E.B. Stuart, screening Robert E. Lee's invasion route, sparred with Maj. Gen. Alfred Pleasonton's Union cavalry. On June 17, Col. Alfred N. Duffié's isolated 1st Rhode Island Cavalry Regiment was attacked by the brigades of Thomas T. Munford and Beverly Robertson. The 1st Rhode Island was routed, taking about 250 casualties. On June 19, J. Irvin Gregg's brigade advanced, driving Stuart's cavalry one mile beyond the town. Both sides were reinforced, and mounted and dismounted skirmishing continued. Stuart was gradually levered out of his position but fell back to a second ridge, still covering the approaches to the Blue Ridge gap.
 Stuart established his headquarters at Middleburg and scattered his brigades throughout the Loudoun Valley to watch for enemy activity. Early in the morning, Col. Alfred N. Duffié, a French-born officer, had taken the 280 men of the 1st Rhode Island Cavalry westward from the Army of the Potomac's camp near Centreville. Pleasonton had ordered him to camp at Middleburg that evening and then to proceed the next day toward Noland's Ferry, extending his march to the west as far as Snickersville. Duffié crossed the Bull Run Mountains at Thoroughfare Gap at 9:30 a.m., easily pushing aside pickets from John R. Chambliss's brigade. Confederate commanders could not believe that a small Union regiment would dare to travel so deep into enemy territory without an escort, so Chambliss did not aggressively attack, fearing that the column was the advance element of a much larger enemy force. Duffié continued on his isolated march, turning to the north by 11:00 a.m. and heading for Middleburg as ordered.
 Arriving there about 4:00 p.m., Duffié drove in the few Confederate pickets deployed there and disrupted Stuart's evening of socializing with local ladies. Stuart and his staff quickly retreated to Rector's Crossroads, the location of his closest brigade. He ordered Beverly Robertson to move immediately to Middleburg to crush the Union cavalry. Duffié barricaded the streets of Middleburg, dismounted half of his regiment behind stonewalls, and sent for help from Judson Kilpatrick's brigade near Aldie. At 7:00 p.m., Stuart's attack routed the vastly outnumbered Rhode Islanders. Many of Duffié's men were captured the next morning as Chambliss cut off their escape route. The Parisian colonel finally returned to Centreville with only 4 officers and 27 men. A few stragglers eventually rejoined the shattered remnants of the regiment. Duffié would never again serve with the Army of the Potomac, although he did command cavalry in other Union armies. The Union casualties on July 17 were reported as 250.
 After the Battle of Aldie, Stuart remained on the defensive, wanting to spoil any Federal attempts to force the passes in the Blue Ridge Mountains. Pleasonton tentatively sent probes towards Ashby's and Snicker's Gaps. On June 18, David McM. Gregg ran into Confederate pickets around Middleburg, and Stuart quickly fell back to a commanding ridge west of town. Fearing a trap, a cautious Pleasonton ordered Gregg to withdraw to Aldie.
 The next day, Gregg again moved against Middleburg, sending the brigade of his first cousin, Col. J. Irvin Gregg, at the Rebels while John Buford's division swung north towards Pot House (New Lisbon). After a flanking march, Buford eventually occupied the ground around Pot House, pushing back two regiments of William "Grumble" Jones's brigade in a mild skirmish.
 After a hard fight to clear reinforced pickets from Middleburg, Colonel Gregg was so impressed by the Confederate position on the high ground beyond the town that he asked for support before attacking. Kilpatrick sent two regiments to help extend the Federal line, and Gregg slowly advanced. The temperature hovered around 98 °F throughout the afternoon, sapping men and horses of energy. A series of Union charges finally forced Stuart's horse artillery to withdraw, and then his cavalry. Several Confederate counterattacks failed to regain control of the ridge.
 Late in the day, Buford sent the U.S. Reserve Brigade back from Pot House, and the 2nd and 6th U.S. Cavalry regiments seized a hotly contested hill south of the tiny village of Millville as darkness fell. Stuart was forced to abandon his position, falling back along the turnpike to stonewalls beyond a ravine along a stream known as Kirk's Branch. A still cautious Pleasonton refused to follow up his success and ordered his men to rest and send out pickets.
 Union losses in the June 19 fight were reported as 16 killed, 46 wounded, and 37 missing. Stuart lost perhaps 40 men, including his chief of staff and friend, Prussian cavalier Heros von Borcke, who was badly wounded by a bullet in his neck. Though von Borcke survived and returned to service the following spring, the bullet remained in his body for the rest of his life, and the lingering wound would ultimately result in his death from sepsis in 1895.
 The Civil War Trust (a division of the American Battlefield Trust) and its partners have acquired and preserved 5 acres (0.020 km2) of the battlefield. Middleburg is one of the most picturesque towns in northern Virginia and features many buildings that existed during the Civil War and were used as hospitals. The town is at the heart of the John Singleton Mosby Heritage Area and an interpretive center at the Rector House four miles west of town tells the story of the Mosby's Rangers of the Confederate Army.
 38°58′04″N 77°45′35″W﻿ / ﻿38.96785°N 77.75973°W﻿ / 38.96785; -77.75973