Many were taken by surprise by the events in Washington, but to those who closely follow conspiracy and extreme right groups online, the warning signs were all there.
At 02:21 Eastern Standard Time on election night, President Trump walked onto a stage set up in the East Room of the White House and declared victory.
"We were getting ready to win this election. Frankly, we did win this election."
His speech came an hour after he'd tweeted: "They are trying to steal the election".
He hadn't won. There was no victory to steal. But to many of his most fervent supporters, these facts didn't matter, and still don't.
Sixty five days later, a motley coalition of rioters stormed the US Capitol building. They included believers in the QAnon conspiracy theory, members of "Stop the Steal" groups, far-right activists, online trolls and others.
On Friday 8 January - some 48 hours after the Washington riots - Twitter began a purge of some of the most influential pro-Trump accounts that had been pushing conspiracies and urging direct action to overturn the election result.
Then came the big one - Mr Trump himself.
The president was permanently banned from tweeting to his more than 88 million followers "due to the risk of further incitement of violence".
The violence in Washington shocked the world and seemed to catch the authorities off guard.
But for anyone who had been carefully watching the unfolding story - online and on the streets of American cities - it came as no surprise.
The idea of a rigged election was seeded by the president in speeches and on Twitter, months before the vote.
On election day, the rumors started just as Americans were going to the polls.
A video of a Republican poll watcher being denied entry to a Philadelphia polling station went viral. It was a genuine error, caused by confusion about the rules. The man was later allowed into the station to observe the count.
But it became the first of many videos, images, graphics and claims that went viral in the days that followed, giving rise to a hashtag: #StopTheSteal.
The message behind it was clear - Mr Trump had won a landslide victory, but dark forces in the establishment "deep state" had stolen it from him.
In the early hours of Wednesday 4 November, while votes were still being counted and three days before the US networks called the election for Joe Biden, President Trump claimed victory, alleging "a fraud on the American public".
Mr Trump did not provide any evidence to back up his claims. Studies carried out for previous US elections have shown that voter fraud is extremely rare.
By mid-afternoon a Facebook group called "Stop the Steal" was created and quickly became one of the fastest-growing in the platform's history. By Thursday morning, it had added more than 300,000 members.
Many of the posts focused on unsubstantiated allegations of mass voter fraud, including manufactured claims that thousands of dead people had voted and that voting machines had somehow been programmed to flip votes from Mr Trump to Mr Biden.
But some of the posts were more alarming, speaking of the need for a "civil war" or "revolution".
By Thursday afternoon, Facebook had taken down Stop the Steal, but not before it had generated nearly half a million comments, shares, likes, and reactions.
Dozens of other groups quickly sprang up in its place.
The idea of a stolen election continued to spread online and take hold. Soon, a dedicated Stop the Steal website was launched in a bid to register "boots on the ground to protect the integrity of the vote".
On Saturday 7 November, major news organisations declared that Joe Biden had won the election. In Democratic strongholds, throngs of people took to the streets to celebrate. But the reaction online from Mr Trump's most ardent supporters was one of anger and defiance.
They planned a rally in Washington DC for the following Saturday, dubbed the Million MAGA (Make America Great Again) March.
Trump tweeted that he might try to stop by the demonstration and "say hello".
Previous pro-Trump rallies in Washington had failed to attract large crowds. But thousands gathered at Freedom Plaza that sunny morning.
One extremism researcher called it the "debut of the pro-Trump insurgency".
As Trump's motorcade drove through the city, supporters screaming with delight rushed to catch a glimpse of the president, who beamed at them wearing a red MAGA hat.
While mainstream conservative figures were present, the event was dominated by far-right groups.
Dozens of members of the far-right, anti-immigrant, all-male group Proud Boys, who have repeatedly been involved in violent street protests and were among those who would later break into the US Capitol, joined the march. Militia groups, far-right media figures and promoters of conspiracy theories were also there.
As night fell, clashes between Trump supporters and counter-protesters broke out, including a brawl about five blocks from the White House.
The violence - although largely contained by police on this occasion - was a clear sign of things to come.
By now, President Trump and his legal team had invested their hopes in dozens of legal cases.
Although a number of courts had already dismissed fraud allegations, many in the pro-Trump online world became fascinated with two lawyers with close ties to the president - Sidney Powell and L Lin Wood.
Ms Powell and Mr Wood promised they were preparing cases of voter fraud so comprehensive that when released, they would destroy the case for Mr Biden having won the presidency.
Ms Powell, 65, a conservative activist and former federal prosecutor, told Fox News that the effort would "release the Kraken" - a reference to a gigantic sea monster from Scandinavian folklore that rises up from the ocean to devour its enemies.
The "Kraken" quickly became an internet meme, representing sprawling, unsubstantiated claims of widespread election fraud.
Ms Powell and Mr Wood became heroes to followers of the QAnon conspiracy theory - who believe President Trump and a secret military intelligence team are battling a deep state made up of Satan-worshipping paedophiles in the Democratic Party, media, business and Hollywood.
The lawyers became a conduit between the president and his most conspiracy-minded supporters - a number of whom ended up inside the Capitol on 6 January.
Ms Powell and Mr Wood were successful in whipping up sound and fury online, but their legal efforts came to nothing.
When they released almost 200 pages of documents in late November, it became clear that their lawsuit consisted predominantly of conspiracy theories and debunked allegations that had already been rejected by dozens of courts.
The filings contained simple legal errors - and basic misspellings and typos.
Still, the meme lived on. The terms "Kraken" and "Release the Kraken" were used more than a million times on Twitter before the Capitol riot.
As courts rejected Mr Trump's legal cases, far-right activists increasingly targeted election workers and officials.
Death threats were made against a Georgia election worker, and Republican officials in the state - including Governor Brian Kemp, Secretary of State Brad Raffensperger and the official in charge of the state's voting systems, Gabriel Sterling - were branded "traitors" online.
Mr Sterling issued an emotional and prescient warning to the president in a press conference on 1 December.
"Someone's going to get hurt, someone's going to get shot, someone's going to get killed, and it's not right," he said.
In Michigan in early December, Secretary of State Jocelyn Benson, a Democrat, had just finished trimming her Christmas tree with her four-year-old son when she heard a commotion outside her Detroit home.
About 30 protesters with banners stood outside, shouting "Stop the steal!" through megaphones.
"Benson, you are a villain," one person yelled.
"You're a threat to democracy!" called another.
One of the demonstrators live-streamed the protest on Facebook, stating that her group was "not going away".
It was just one of a rash of protests targeting people involved in the vote.
In Georgia, a constant stream of Trump supporters drove past Mr Raffensperger's home, honking their horns. His wife received threats of sexual violence.
In Arizona, demonstrators gathered outside of the home of Secretary of State Katie Hobbs, a Democrat, at one point warning: "We are watching you."
On 11 December, the Supreme Court rejected an attempt by the state of Texas to throw out election results.
As the president's legal and political windows continued to close, the language in pro-Trump online circles became increasingly violent.
On 12 December, a second Stop the Steal rally was held in the capital. Once again, thousands attended, and once again prominent far-right activists, QAnon supporters, fringe MAGA groups and militia movements were among the demonstrators.
Michael Flynn, Mr Trump's former national security advisor, likened the protesters to the biblical soldiers and priests breaching the walls of Jericho. This echoed the rally organisers' call for "Jericho Marches" to overturn the election result.
Nick Fuentes, the leader of Groypers, a far-right movement that targets Republican politicians and figures they deem too moderate, told the crowd: "We are going to destroy the GOP!"
The march once again turned violent.
Then two days later, the Electoral College certified Mr Biden's victory, one of the final steps required for him to take office.
On online platforms, supporters were becoming resigned to the view that all legal avenues were dead ends, and only direct action could save the Trump presidency.
Since election day, alongside Mr Flynn, Ms Powell and Mr Wood, a new figure had rapidly gained prominence among pro-Trump circles online.
Ron Watkins is the son of Jim Watkins, the man behind 8chan and 8kun - message boards filled with extreme language and views, violence and extreme sexual content. They gave rise to the QAnon movement.
In a series of viral tweets on 17 December, Ron Watkins suggested President Trump should follow the example of Roman leader Julius Caesar, and capitalise on "fierce loyalty of the military" in order to "restore the Republic".
Ron Watkins encouraged his more than 500,000 followers to make #CrossTheRubicon a Twitter trend, referring to the moment when Caesar launched a civil war by crossing the Rubicon river in 49BC. The hashtag was also used by more mainstream figures - including the chairwoman of Arizona Republican Party, Kelli Ward.
In a separate tweet, Ron Watkins said Mr Trump must invoke the Insurrection Act, which empowers the president to deploy the military and federal forces.
Mr Trump met Ms Powell, Mr Flynn and others at a strategy meeting at the White House the following day, 18 December.
During the meeting, according to the New York Times, Mr Flynn called on Mr Trump to impose martial law and deploy the military to "rerun" the election.
The meeting further stoked online chatter about "war" and "revolution" in far-right circles. Many came to see the joint session of Congress on 6 January, normally a formality, as a last roll of the dice.
A wishful story began to take hold among QAnon and some MAGA supporters. They hoped that Vice-President Mike Pence, who was set to preside over the 6 January ceremony, would ignore the electoral college votes.
The president, they said, would then deploy the military to quell any unrest, order the mass arrest of the "deep state cabal" who had rigged the election and send them to Guantanamo Bay military prison.
Back in the land of reality, none of this was remotely feasible. But it launched a movement for "patriot caravans" to organise ride shares to help transport thousands from around the country to Washington DC on 6 January.
Long processions of vehicles flying Trump flags and sometimes towing elaborately decorated trailers gathered in car parks in cities including Louisville, Kentucky, Atlanta, Georgia, and Scranton, Pennsylvania.
"We are on our way," one caravaner posted on Twitter with a picture of about two dozen supporters.
At an Ikea parking lot in North Carolina, another man showed off his truck. "The flags are a little tattered - we'll call them battle flags now," he said.
As it became clear that Mr Pence and other key Republicans would follow the law and allow Congress to certify Mr Biden's win, the language towards them became vicious.
"Pence will be in jail awaiting trial for treason," Mr Wood tweeted. "He will face execution by firing squad."
Online discussion reached boiling point. References to firearms, war and violence were rife on self-styled "free speech" social platforms such as Gab and Parler, which are popular with Trump supporters, as well as on other sites.
In Proud Boys groups, where members had once supported police, some turned against authorities, whom they deemed to no longer be on their side.
Hundreds of posts on a popular pro-Trump site, TheDonald, openly discussed plans to cross barricades, carry firearms and other weapons to the march in defiance of Washington's strict gun laws. There was open chatter about storming the Capitol and arresting "treasonous" members of Congress.
On Wednesday 6 January, Mr Trump addressed a crowd of thousands at the Ellipse, a park just south of the White House, for more than an hour.
Early on he encouraged supporters to "peacefully and patriotically make your voices heard", but he ended with a warning. "We fight like hell, and if you don't fight like hell, you're not going to have a country anymore.
"So we're going to, we're going to walk down Pennsylvania Avenue… and we're going to the Capitol."
To some observers, the potential for violence that day was clear from the outset.
Michael Chertoff, former secretary of homeland security under President George W Bush, blamed the Capitol Police, who reportedly turned down offers of assistance from the much larger National Guard ahead of time. He characterised it as "the worst failure of a police force I can think of".
"I think it was a very foreseeable potential negative turn of events," Mr Chertoff said.
"To be blunt, it was obvious. If you read the newspaper and were awake, you understood that you've got a lot of people who have been convinced there was a fraudulent election. Some of them are extremists, and violent. Some of the groups openly said, 'Bring your guns'."
Still, many Americans were astonished by Wednesday's scenes, like James Clark, a 68-year-old Republican from Virginia.
"I find it absolutely shocking. I didn't think it would come to this," he told the BBC.
But the signs were there for weeks. A hodgepodge of extreme and conspiratorial groups were convinced that the election was stolen. Online, they repeatedly talked about arming themselves, and violence.
Perhaps the authorities didn't think their posts were serious, or specific enough to investigate. They now face pointed questions.
For Joe Biden's inauguration on 20 January, Mr Chertoff is expecting a "much stronger showing" by security services than last Wednesday night.
But that hasn't stopped many on extreme platforms calling for further violence and disruption on the day.
There are questions, too, for the major social media platforms, which enabled conspiracy theories to reach millions of people.
Late on Friday, Twitter deleted the accounts of Mr Flynn, the former Trump advisor, the "Kraken" lawyers Ms Powell and Mr Wood, and Mr Watkins. Then Mr Trump himself.
Arrests of those who stormed the Capitol continue. But most of the rioters still live in a parallel online universe - a subterranean world filled with alternative facts.
They have already come up with fanciful explanations to dismiss Mr Trump's video statement, posted on Twitter the day after the riots, in which he acknowledged for the first time that "a new administration will be inaugurated on 20 January".
He can't possibly be giving up, they contend. Among their new theories - it's not really him in the video but a computer-generated "deep fake". Or perhaps the president is being held hostage.
Many still believe Mr Trump will prevail.
There's no evidence behind any of this, but it does prove one thing.
No matter what happens to Donald Trump, the rioters who stormed the US Capitol are not backing down anytime soon.
Additional reporting: Olga Robinson and Jake Horton
All photographs subject to copyright