Four years earlier, in the election of 1876, Republican Rutherford B. Hayes of Ohio defeated Democrat Samuel J. Tilden of New York in one of the most hotly contested presidential elections in the nation's history. The results initially indicated a Democratic victory, but the electoral votes of several states were disputed until just a few days before the new president was to be inaugurated. Members of both parties in Congress agreed to convene a bipartisan Electoral Commission, which ultimately decided the race for Hayes.