
Maryland did not secede from the Union during the American Civil War; however, when Union soldiers marched through the city at the start of the war, Confederate sympathizers attacked the troops, which led to the Baltimore riot of 1861. Four soldiers and 12 civilians were killed during the riot, which caused Union troops to occupy Baltimore. Maryland came under direct federal administration—in part, to prevent the state from seceding—until the end of the war in April 1865.
Following an economic depression known as the Panic of 1873, the Baltimore & Ohio Railroad company attempted to lower its workers' wages, leading to the Great Railroad Strike of 1877. On July 20, 1877, Maryland Governor John Lee Carroll called up the 5th and 6th Regiments of the National Guard to end the strikes, which had disrupted train service at Cumberland in western Maryland. Citizens sympathetic to the railroad workers attacked the national guard troops as they marched from their armories in Baltimore to Camden Station. Soldiers from the 6th Regiment fired on the crowd, killing 10 and wounding 25. Rioters then damaged B&O trains and burned portions of the rail station. Order was restored in the city on July 21–22 when federal troops arrived to protect railroad property and end the strike.