Soon after the outbreak of the Civil War, U.S. Army commander Major General and Brevet Lieutenant General Winfield Scott, bearing in mind Barnard's success at defending his Tampico-based supply lines during the Mexican–American War, assigned then Major Barnard to the Department of Washington. This was the Union Army unit in charge of defending Washington, D.C., the capital of the United States. On April 28, 1861, Colonel Joseph K. Mansfield, the department commander, a former engineer himself, attached Barnard to his headquarters as chief engineer.