Buchanan resigned his position in the U.S. Navy as commander of the Washington Navy Yard to become a captain in the Confederate Navy. He commanded the CSS Virginia in 1861, until he was wounded at Hampton Roads. In August 1862, he was promoted to the rank of admiral and assumed command of Mobile Harbor. At the Battle of Mobile Bay, he was defeated while in command of the ram, Tennessee. He was wounded and taken prisoner. He was exchanged in February 1865 but did not return to service.