Entirely precedented, unfortunately. Allow me to introduce one of the most important US Presidential Elections of all time, that produced an illegitimate President that stole the election, and rolled back decades of civil rights progress. No, I am not talking about 2016. I am talking about 1876.
1876 was bad. Like, way fucking worse then now. The race was between the Democratic Tilden, and the Republican Hayes. At stake was the future of the reconstruction governments across the south. The results of the election are... still heavily disputed to this day. Tilden apparently won, by a lot, with 184 Electorial votes to Hayes 164. Tilden also won the popular vote comfortably. That total doesn't include 3 southern states, Florida, South Carolina, and Louisiana though. All three states had Republican reconstruction governments, and also a massive up-welling of Klan and Neo-Confederate groups resentful of that control. These groups barricaded polling places, threatened, attacked, and lynched black voters, and packed ballot boxes with democratic votes. Resulting in all three states reporting results of overwhelming support for Tilden, but the Republican government invalidated the results, threw them out, and declared for Hays.
How bad was all this? Well, in Louisiana, part of the run up to this was the "Battle of Liberty Place", where 5,000 members of the White League (Exactly what it sounds like) attacked the police and government of New Orleans over the disputed gubernatorial election of 1874. Over 30 people died (And New Orleans built a massive monument honoring the White League, which they only took down in 2017). Even more extreme violence was assumed from this disastrous presidential election. In South Carolina, voter turnout was 101%, which is the highest voter turnout in all of US history, and also obviously impossible. This was even after the South Carolina government threw away thousands of democratic ballots, that was the official final tally.
So what wound up happening is Hayes was awarded all 20 outstanding electoral votes, making Rutherford B. Hayes a US President who was almost certainly never elected to that role (But probably would have been if White Southerners hadn't suppressed Black voters and cheated like crazy). In return, the Democrats got the official end of Reconstruction, the full reinstatement of southern States, and Democratic state governments across the south that passed new state constitutions, passed sweeping voter disenfranchisement, and locked the American South into a White Supremacist government that is just now starting to show cracks.
Bottom line: We have been here before. It got really ugly, and it left scars that lasted to today.