Early returns indicated one candidate had won, but state-controlled election commissions invalidated some of the results, claiming fraud. The Congress was divided; one party controlled the House, the other the Senate. 100,000 armed men were said to be ready to march on Washington if their candidate was not elected. It was a constitutional crisis!
This was the situation in the Presidential Election of 1876 and it was ultimately resolved by Congress through the Electoral Commission Act of 1876 and to prevent problems in the future, they enacted the Electoral Count Act of 1877.
It’s a fascinating slice of American history, and gives insight on how questions about the election of the American President can be dealt with by Congress. Check it out at the Wikipedia.