During the Presidential Election of 1876, there was the agreement of the Compromise of 1877. This compromise was settled between Democratic candidate Samuel Tilden and Republican candidate Rutherford B. Hayes.
The Compromise said that Democrats agreed that Hayes would become president but in return, the federal troops would be removed from the Southern states, this ended the Reconstruction Era and the South regained it’s autonomy.