After the defeat of the Confederacy, federal forces remained in Charleston during the city's reconstruction. The war had shattered the prosperity of the antebellum city. Freed slaves were faced with poverty and discrimination, but a large community of free people of color had been well-established in the city before the war and became the leaders of the postwar Republican Party and its legislators. Men who had been free people of color before the war comprised 26% of those elected to state and federal office in South Carolina from 1868 to 1876.