On the afternoon of July 5, 1863, Williamsport was inundated with the arrival of 7,000 wounded Confederate soldiers retreating from the Battle of Gettysburg. The ambulance train, under the command of Brigadier General John Imboden, arrived to find the Potomac River swollen with rain and the temporary pontoon bridge destroyed. Trapped in Williamsport, the Confederates turned the town into a medical center as private homes and public buildings, especially churches, became makeshift hospitals. Imboden ordered the citizens of Williamsport to feed the hungry men, and Confederate surgeons treated the wounded, most of whom had received no medical care since being wounded days earlier. Dr. John M. Gaines of the 18th Virginia Infantry served as Surgeon in Charge at Williamsport. Most of the wounded were evacuated by July 14, but Dr. Gaines remained behind to care for the over 200 patients left behind, becoming a prisoner under Union occupation.