Barney was appointed a lieutenant in the Confederate States Navy on July 2, 1861. He commanded the
CSS Jamestown during the
Battle of Hampton Roads, the famous battle with the , during which he captured two brigs and an Accomac schooner off Newport News Point while the
CSS Virginia held the
Union Navy's attention. After the Confederate evacuation of
Norfolk, the
Jamestown was scuttled to block the
James River at
Drewry's Bluff. In the subsequent
Battle of Drewry's Bluff, in which Confederate shore batteries drove off a Union Navy force heading towards
Richmond, the
Jamestown's guns were considered the main factor in repulsing the enemy ships. Following the battle, he received praise from the
Confederate Congress and was promoted to
commander. In early 1863, Barney was briefly assigned command of naval operations in Galveston, including the revenue cutter
Harriet Lane, captured in the
Battle of Galveston. However the ship was already under command of
Leon Smith, an army volunteer and steamboat captain, who had played a role in capturing the ship, having been placed in command of the ship by Major General
John B. Magruder and in control of additional ships improvised as a "
cottonclad fleet". The ship was also considered by the navy to be too slow and inefficient to become a
blockade runner, though it was later used in this capacity. Following discussions with Magruder, who was not willing to relinquish controls of the cottonclads, Barney conceded the appointment, and in a letter to Confederate Naval Secretary
Stephen Mallory, recommended that the navy relinquish control. Barney later explained that he made his recommendation since he considered that the presence of two separate marine forces with independent commanders would lead to discord and confusion. Barney was sent to Europe in spring 1863. He assumed command of the Confederate raider
CSS Florida in September 1863, relieving the ailing
John Newland Maffitt, and oversaw her refit at
Brest, France, but had to be detached due to ill health before the
Florida put to sea. From 1864 to 1865, he was a Confederate naval agent in Europe. He returned to the United States following the war, and took the Oath of Allegiance to the U.S. Constitution in September 1865. == Later life ==