Although he had been opposed to secession for Virginia, during the American Civil War, he joined the regular forces. The 32nd Virginia Infantry was accepted into Confederate service on July 1, 1861, after it had been formed for local defense at Hampton by Ewell from several local militia units from Elizabeth City County, Warwick County, York County, and James City County. He was commissioned as a colonel in the Confederate Army. In 1861 and 1862, under General John B. Magruder and the Army of the Peninsula, Ewell had the primary responsibility for developing and constructing the Williamsburg Line, a line of defensive fortifications across the Virginia Peninsula east of Williamsburg anchored by College Creek a tributary of the James River on the south and Queen's Creek, a tributary of the York River on the north. A series of 14 redoubts were built along the line, with the earthen Fort Magruder at the junction of the two main loads leading from the lower Peninsula to the east, the Williamsburg-Yorktown Road, and the Lee's Mill Road.