At the start of the Civil War, Gwynn was a
major in the engineers of the South Carolina Militia. At the request of the governor, he had accepted the commission and was instrumental in the planning of the attack on
Fort Sumter in early 1861 as a member of the Ordnance Board. He was later charged with constructing batteries at various strategic points in
Charleston Harbor, facing Fort Sumter. On April 10, 1861, he accepted a commission as
major general of the Virginia Militia and was directed by Virginia governor
John Letcher to assume command of the defenses around
Norfolk and
Portsmouth until mid-May. Working with Gwynn at Norfolk was
William Mahone, who was the president of the
Norfolk and Petersburg Railroad. Working under Gwynn's authority, Mahone (who was still a civilian) helped bluff the Federal troops into abandoning the
Gosport Shipyard in Portsmouth by running a single passenger train into Norfolk with great noise and whistle-blowing, then much more quietly, sending it back west, and then returning the same train again, creating the illusion of large numbers of arriving troops to the Federals listening in Portsmouth across the
Elizabeth River (and just barely out of sight). The
ruse worked, and not a single Confederate soldier was lost as the Union authorities abandoned the area, and retreated to
Fort Monroe across
Hampton Roads. In 1861, Gwynn oversaw construction of defensive fortifications at
Sewell's Point, which was across the mouth of
Hampton Roads from
Fort Monroe at
Old Point Comfort. He also participated in the
Battle of Big Bethel during the Blockade of the
Chesapeake Bay. Gwynn also served as a
brigadier general in the Virginia Provisional Army and then brigadier general in the North Carolina Militia, commanding the Northern Coast Defenses of North Carolina. All of these general-officer assignments were in the spring and summer of 1861. By August he joined the
Confederate States Army as a major of engineers and was promoted to
colonel on October 9, 1862. (Fellow railroader Mahone also joined the Confederate Army, eventually achieving the rank of major general after becoming the so-called 'Hero of the
Battle of the Crater,' which took place near Petersburg in 1864.) ==Later life==