Throughout the campaign trail, Donald Trump has condemned the 2016 presidential election as "rigged" and doubted the integrity of the US voting system.
The third presidential debate even saw him refuse to confirm he would concede the election if defeated by Hillary Clinton at the polls, a customary step in democratic elections.
But what will happen if Trump does refuse to accept the result or even takes legal action to contest it?
Here's a guide to how the various scenarios could play out:
- What would happen if Trump loses the election and refuses to concede?
In short: it would be politically dramatic but legally meaningless.
While Trump would face widespread criticism for undermining the peaceful transition of power, the impact of the refusal to concede would carry no legal weight at all.
The concession tradition is exactly that: a tradition - not a rule, requirement or law.
In fact it only began in the 1950s as televised speeches became a regular part of election night coverage.
The losing candidate traditionally concedes by privately calling the winner before publicly acknowledging the loss in a concession speech.
- What happens if a candidate mounts legal action to contest the result?
This step would obviously carry legal weight but its impact would solely depend on whether the overall result is in jeopardy.
If either candidate contests a state result, they would need the numbers to back their claim up.
For example, if the candidates were separated by a winning margin of 10 electoral votes, contesting the result in Florida (29 electoral votes) would impact the overall result but contesting the result in New Hampshire (four electoral votes) would not.
There is an obvious recent precedent in this area, set 16 years ago in the battle between George W Bush and Al Gore.
The 2000 vote saw the Florida result contested as the Republican Bush and Democratic Gore were separated by under 25 votes before the former was ultimately - and controversially - declared the winner a month later by a 5-4 vote of the Supreme Court.
Note: In 2016 the now eight Supreme Court justices could deliver a 4-4 deadlocked result if a similar scenario occurs.
- What margins are required to force a recount?
The four states which are most keenly contested in the 2016 election - popularly known as the biggest "battleground states" - Florida, Pennsylvania, Ohio and North Carolina - all demand the candidates to be separated by a winning margin of less than 0.5% of the popular vote to trigger a recount.
If a state is decided by more than 0.5% of the popular vote the losing candidate is not entitled to a recount.
They would have to pay for a recount, which may not be a problem for either Trump or Clinton, but the state result would be nearly certain to remain the same.
- What happens if a candidate mounts legal action to contest a rigged election?
While Trump has stopped short of giving specifics as to how the 2016 election is "rigged", an alternative possible legal route to take could be to contest that voter fraud or vote tampering has taken place.
This effectively contests the manner in which the vote was collected rather than the actual result returned.
But costly lawsuits in this area would likely to be doomed as judges demand overwhelming evidence to take action that would overturn such a large number of votes.
There is no precedent for this at a national level.
- How soon must a candidate launch legal action?
Although the deadlines for a losing candidate to launch legal action differ from state to state, if Trump does refuse to concede he will have to act fast.
Ohio demands it by November 13 while other states demand it within two business days of scheduled local post-election review of ballots.
So if either candidate chooses to take legal action they must do it within days of the result being declared.