In the 1876 presidential election, Republican Rutherford B. Hayes faced Democrat Samuel Tilden. Tilden won the popular vote, but the election was disputed, with each side claiming victory in different states. To resolve the dispute, Congress reached a compromise: Hayes would be awarded the presidency, but Reconstruction would effectively end in the South, with all federal troops being withdrawn.
Hope this helps :)