It was just before noon in Moscow on March 10, 2016, when the first volley of malicious messages hit the Hillary Clinton campaign.
The first 29 phishing emails were almost all misfires. Addressed to people who worked for Mrs Clinton during her first presidential run in 2008, the messages bounced back untouched.
Within nine days, some of the campaign's most consequential secrets would be in the hackers' hands, part of a massive operation aimed at vacuuming up millions of messages from thousands of inboxes across the world.
It was not just a few aides that the hackers went after; it was an all-out blitz across the Democratic Party.
They tried to compromise Mrs Clinton's inner circle and more than 130 party employees, supporters and contractors.
While US intelligence agencies have concluded that Russia was behind the email thefts, the AP drew on forensic data to report that the hackers known as Fancy Bear were closely aligned with the interests of the Russian Government.
The following reconstruction — based on a database of 19,000 malicious links recently shared by cybersecurity firm Secureworks — shows how the hackers worked their way around the Clinton campaign's top-of-the-line digital security to steal chairman John Podesta's emails in March 2016.
It also helps explain how a Russian-linked intermediary could boast to a Trump policy adviser, a month later, that the Kremlin had "thousands of emails" worth of dirt on Mrs Clinton.
Phishing for victims
The rogue messages that first flew across the internet on March 10 were dressed up to look like they came from Google, the company that provided the Clinton campaign's email infrastructure.
The messages urged users to boost their security or change their passwords while in fact steering them toward decoy websites designed to collect their credentials.
Almost everyone targeted in the initial wave was a 2008 staffer whose defunct email address had somehow lingered online.
But one email made its way to the account of another staffer who had worked for Mrs Clinton in 2008 and joined again in 2016, the AP found.
It is possible the hackers broke in and stole her contacts; the data shows the phishing links sent to her were clicked several times.
Secureworks' data reveals when phishing links were created and indicates whether they were clicked. But it does not show whether people entered their passwords.
Within hours of a second volley emailed March 11, the hackers hit pay dirt.
All of a sudden, they were sending links aimed at senior Clinton officials' non-public 2016 addresses, including those belonging to longtime Clinton aide Robert Russo and campaign chairman John Podesta.
The Clinton campaign was no easy target; several former employees said the organisation put particular stress on digital safety.
Work emails were protected by two-factor authentication, a technique that uses a second passcode to keep accounts secure.
Most messages were deleted after 30 days and staff went through phishing drills.
Security awareness even followed the campaigners into the bathroom, where someone put a picture of a toothbrush under the words: "You shouldn't share your passwords either."
Two-factor authentication may have slowed the hackers, but it did not stop them. After repeated attempts to break into various staffers' hillaryclinton.com accounts, the hackers turned to the personal Gmail addresses.
It was there on March 19 that they targeted top Clinton lieutenants — including campaign manager Robby Mook, senior adviser Jake Sullivan and political fixer Philippe Reines.
A malicious link was generated for Mr Podesta at 11:28 am Moscow time, the AP found.
Documents subsequently published by WikiLeaks show that the rogue email arrived in his inbox six minutes later. The link was clicked twice.
Mr Podesta's messages — at least 50,000 of them — were in the hackers' hands.
A serious breach
Though the heart of the campaign was now compromised, the hacking efforts continued.
Three new volleys of malicious messages were generated on March 22, 23 and 25, targeting communications director Jennifer Palmieri and Clinton confidante Huma Abedin, among others.
The torrent of phishing emails caught the attention of the FBI, which had spent the previous six months urging the Democratic National Committee in Washington to raise its shield against suspected Russian hacking.
- March 10 - Initial wave targets 2008 campaign staff emails
- March 10 - Phishing links in one email clicked several times
- March 11 - Links sent to Clinton officials' non-public 2016 addresses
- March 19 - Malicious link sent for John Podesta and clicked twice
- March 22, 23 and 25 - More emails target high-ranking Clinton officials
- Late March - Secureworks discovers hackers going after Democrats
- April 12 - Someone pays bitcoin to reserve website Electionleaks.com
- April 20 - DNC consultant warned account under threat from state-sponsored hackers
- April 26 - Russian-linked professor boasts of "thousands of emails" of dirt
- June 10 - Top secret meeting held in DNC's main conference room
- June 14 - Democrats go public with Russian hacking allegations
- June 15 - Guccifer 2.0 to have hacked DNC in email to news editor
- July 22 - Wikileaks releases its own disclosures
- October 7 - Wikileaks begins publishing emails stolen from John Podesta
- November 8 - Donald Trump wins the US presidential election
In late March, FBI agents paid a visit to Mrs Clinton's Brooklyn headquarters, where they were received warily, given the agency's investigation into the candidate's use of a private email server while secretary of state.
The phishing messages also caught the attention of Secureworks, a subsidiary of Dell Technologies, which had been following Fancy Bear, whom Secureworks codenamed Iron Twilight.
Fancy Bear had made a critical mistake.
It fumbled a setting in the Bitly link-shortening service that it was using to sneak its emails past Google's spam filter. The blunder exposed whom they were targeting.
It was late March when Secureworks discovered the hackers were going after Democrats.
"As soon as we started seeing some of those hillaryclinton.com email addresses coming through, the DNC email addresses, we realised it's going to be an interesting twist to this," said Rafe Pilling, a senior security researcher with Secureworks.
By early April Fancy Bear was getting increasingly aggressive. More than 60 bogus emails were prepared for Clinton campaign and DNC staffers on April 6 alone.
Employees at several organisations connected to the Democrats were targeted, including the Clinton Foundation, the Centre for American Progress, technology provider NGP VAN, campaign strategy firm 270 Strategies, and partisan news outlet Shareblue Media.
Trump advisor told about 'dirt' on Hillary Clinton
As the hacking intensified, other elements swung into place.
On April 12, 2016, someone paid $US37 worth of bitcoin to the Romanian web hosting company THCServers.com to reserve a website called Electionleaks.com, according to transaction records obtained by AP.
A botched registration meant the site never got off the ground, but the records show THC received a nearly identical payment a week later to create DCLeaks.com.
By the second half of April, the DNC's senior leadership was beginning to realise something was amiss.
One DNC consultant, Alexandra Chalupa, received an April 20 warning from Yahoo saying her account was under threat from state-sponsored hackers, according to a screengrab she circulated among colleagues.
The Trump campaign had gotten a whiff of Clinton email hacking, too.
According to recently unsealed court documents, former Trump foreign policy adviser George Papadopoulos said that it was at an April 26 meeting at a London hotel that he was told by a professor closely connected to the Russian government that the Kremlin had obtained compromising information about Mrs Clinton.
"They have dirt on her," Mr Papadopoulos said he was told.
"They have thousands of emails."
A few days later, Amy Dacey, then the DNC chief executive, got an urgent call.
There had been a serious breach at the DNC.
'Don't even talk to your dog about it'
It was 4:00 pm on Friday June 10 when some 100 staffers filed into the Democratic National Committee's main conference room for a mandatory, all-hands meeting.
"What I am about to tell you cannot leave this room," DNC chief operating officer Lindsey Reynolds told the assembled crowd, according to two people there at the time.
Everyone needed to turn in their laptops immediately; there would be no last-minute emails; no downloading documents and no exceptions.
Ms Reynolds insisted on total secrecy.
"Don't even talk to your dog about it," she was quoted as saying.
Ms Reynolds did not return messages seeking comment.
Two days later, as the cybersecurity firm that was brought in to clean out the DNC's computers finished its work, WikiLeaks founder Julian Assange told a British Sunday television show that emails related to Mrs Clinton were "pending publication".
"WikiLeaks has a very good year ahead," he said.
On Tuesday, June 14, the Democrats went public with the allegation that their computers had been compromised by Russian state-backed hackers, including Fancy Bear.
Shortly after noon the next day, William Bastone, the editor-in-chief of investigative news site The Smoking Gun, got an email bearing a small cache of documents marked "CONFIDENTIAL".
"Hi," the message said.
"This is Guccifer 2.0 and this is me who hacked Democratic National Committee."
'Can it influence the election?'
Guccifer 2.0 acted as a kind of master of ceremonies during the summer of leaks, proclaiming that the DNC's stolen documents were in WikiLeaks' hands, publishing a selection of the material himself and constantly chatting up journalists over Twitter in a bid to keep the story in the press.
He appeared particularly excited to hear on June 24 that his leaks had sparked a lawsuit against the DNC by disgruntled supporters of Mrs Clinton's rival Bernie Sanders.
"Can it influence the election in any how?" he asked a journalist with Russia's Sputnik News, in uneven English.
Later that month Guccifer 2.0 began directing reporters to the newly launched DCLeaks site, which was also dribbling out stolen material on Democrats.
When WikiLeaks joined the fray on July 22 with its own disclosures the leaks metastasised into a crisis, triggering intraparty feuding that forced the resignation of the DNC's chairwoman and drew angry protests at the Democratic National Convention.
Guccifer 2.0, WikiLeaks and DCLeaks ultimately published more than 150,000 emails stolen from more than a dozen Democrats, according to an AP count.
The AP has since found that each of one of those Democrats had previously been targeted by Fancy Bear, either at their personal Gmail addresses or via the DNC, a finding established by running targets' emails against the Secureworks' list.
All three leak-branded sites have distanced themselves from Moscow. DCLeaks claimed to be run by American hacktivists. WikiLeaks said Russia was not its source. Guccifer 2.0 claimed to be Romanian.
But there were signs of dishonesty from the start.
The first document Guccifer 2.0 published on June 15 came not from the DNC as advertised but from Mr Podesta's inbox, according to a former DNC official who spoke on condition of anonymity because he was not authorised to speak to the press.
The official said the word "CONFIDENTIAL" was not in the original document.
Guccifer 2.0 had airbrushed it to catch reporters' attention.
'Please God, don't let it be me'
The attacks had a serious destablising effect on the Clinton campaign, and an atmosphere of dread settled over the Democrats as the disclosures continued.
One staffer described walking through the DNC's office in Washington to find employees scrolling through articles about Putin and Russia.
Another said she began looking over her shoulder when returning from Clinton headquarters in Brooklyn after sundown.
Even those who had not worked at Democratic organisations for years were anxious.
Brent Kimmel, a former technologist at the DNC, remembers watching the leaks stream out and thinking: "Please God, don't let it be me."
On October 7, it was Mr Podesta.
The day began badly, with Hillary Clinton's phone buzzing with crank messages after its number was exposed in a leak from the day before.
The number had to be changed immediately; a former campaign official said that Ms Abedin, Mrs Clinton's confidante, had to call staffers one at a time with Mrs Clinton's new contact information because no one dared put it in an email.
The same afternoon, just as the American electorate was digesting a lewd audio tape of Mr Trump boasting about sexually assaulting women, WikiLeaks began publishing the emails stolen from Mr Podesta.
The publications sparked a media stampede as they were doled out one batch at a time, with many news organisations tasking reporters with scrolling through the thousands of emails being released in tranches.
At the AP alone, as many as 30 journalists were assigned, at various times, to go through the material.
Guccifer 2.0 told one reporter he was thrilled that WikiLeaks had finally followed through.
"Together with Assange we'll make america great again," he wrote.