This is an image of Rutherford B. Hayes, the 19th President of the United States. He lost the popular vote by 3%, but achieved the Presidency via an agreement that ended Reconstruction. He was installed in the office in a private ceremony at the White House on March 3rd, 1877.  According to This Day in History:

some historical accounts claim that Hayes’ first swearing-in ceremony had occurred in secret due to threats made on the new president’s life [because] his 1876 election had been hotly contested. For four months, competing factions in Congress as well as their like-minded countrymen argued over the election results. Hayes had lost the popular vote by a slim margin of 250,000 votes, yet appeared to have won a majority in the Electoral College. Accusations of fraudulent Electoral College vote counts in three southern states (including Florida, which would again play a major role in a contested election in 2000) led Congress to form an electoral commission to make the final decision. On March 2, the commission voted along party lines and put the Republican, Hayes, in office.

As will be discussed extensively in subsequent posts, there is no way to adequately convey to a modern day reader the level of bigotry and blatant hatred toward Blacks that characterized the South and the United States more generally during the period in which Blacks were enslaved and for many decades subsequent to the military defeat of the Confederacy. 

Hayes was a Republican, the "party of Lincoln."  But, via an informal arrangement, he accepted the terms of the Democrats, who represented the so-called "conservative" forces of the nation, i.e., those who had no qualms about despising Blacks in obviously racist language (We're talking about the constant use of the "n" word.). To become president, Hayes agreed to remove US troops from providing former slaves with even a fig leaf's worth of protection from violent Southerners. It was an absolutely shameful abadonment of a people to whom so much was owed and so little was paid.

Under the compromise, Democrats controlling the House of Representatives allowed the decision of the Electoral Commission to take effect. The outgoing president, Republican Ulysses S. Grant, removed the soldiers from Florida, and as president, Hayes removed the remaining troops from South Carolina and Louisiana. As soon as the troops left, many white Republicans also left, and the "Redeemer" Democrats, who already dominated other state governments in the South, took control. Some black Republicans felt betrayed as they lost their power in the South that had been propped up by the federal military, and by 1905 most black people were effectively disenfranchised in every Southern state.