In late July 2016, nobody thought Trump could win.

The Republican National Convention had ended on July 21, and the campaign seemed to be flailing after a fractious confab, with a Republican elite that appeared determined to sit out the rest of the campaign.

But a detailed look at the timeline of the week following the end of the Republican National Convention — from July 22 to July 27 — reveals that amid widespread skepticism of Trump’s presidential bid, Trump’s longtime friend Roger Stone embarked on a desperate push to get more information on what emails Wikileaks, which dropped its first tranche on July 22, had at its disposal.

The push, according to an indictment unveiled Friday against Stone, came after an unnamed Trump campaign official was directed by an unknown person to contact Stone “about any additional releases and what other damaging information” Wikileaks “had regarding the Clinton campaign.” Thus began a months-long backchannel between the Trump campaign and Wikileaks via Stone.

But one day after the close of the Republican National Convention in Cleveland, it was a different time. Wikileaks had just begun to publish damaging emails showing the internal deliberations of Democratic National Committee staffers during the 2016 primary. The emails dropped the Friday before the Democratic convention was set to begin the following Monday.

Trump himself and those in his inner circle rushed to highlight the divisions within the Democratic Party exposed by the Wikileaks dump, just as the party headed into its national convention. The GOP nominee both scoffed at the idea that Russia was behind the leaks, while continuing to tout his warm feelings for Russian President Vladimir Putin and support for policy positions advanced by the Russian leader.

Sometime after the July 22 email release, “a senior Trump Campaign official was directed to contact STONE” about what else Wikileaks had, according to the Stone indictment.

The number of people in a position to direct a senior campaign official — apart from the candidate — is extremely limited.

It is also not clear when exactly that direction was handed down to the official. But “thereafter,” Stone “told the Trump Campaign about potential future releases of damaging material” from Wikileaks, the indictment says.

By July 25, Stone had begun via email hassling “Person 1,” as the indictment dubs the individual who appears to be far-right conspiracy theorist Jerome Corsi, about establishing contact with Assange and getting “the pending” Wikileaks emails …”they deal with Foundation, allegedly.” Corsi forwarded Stone’s message to Ted Malloch, a London-based conservative writer, and Stone’s outreach to Corsi about Assange would continue through late July and August.

During that same initial weekend, Trump ramped up his promotion of the material released by Wikileaks and specifically sought to convince Bernie Sanders’ support not to support Hillary Clinton.

The Wikileaks e-mail release today was so bad to Sanders that it will make it impossible for him to support her, unless he is a fraud! — Donald J. Trump (@realDonaldTrump) July 23, 2016

Trump hammered away at points drawn from the email stash, tweeting “Sorry folks, but Bernie Sanders is exhausted, just can’t go on any longer. He is trying to dismiss the new e-mails and DNC disrespect. SAD!”

He also mocked assertions that Russia was behind the hack.

The new joke in town is that Russia leaked the disastrous DNC e-mails, which should never have been written (stupid), because Putin likes me — Donald J. Trump (@realDonaldTrump) July 25, 2016

At a campaign rally on that Monday, July 25, just as the Democratic convention was getting underway, Trump claimed that “Crazy Bernie” had gone “crazy right now,” because “he doesn’t know what to do.”

“He’s losing his legacy because he’s just sort of giving up. He’s all in for Hillary now,” Trump said at the North Carolina rally, where he also tweaked Clinton’s decision three days prior to make Sen. Tim Kaine (D-VA) her running mate. Trump framed the selection of the “weird little dude,” a mild-mannered Democrat, as an insult to Sanders’ more fiery, progressive base.

Trump’s remarks fit into a larger effort by the campaign to seize on the divisions left by the Democratic primary and break up support for Hillary Clinton.

The Wikileaks emails were crucial to that effort, providing a base for Trumpian attacks that could be read as credible by those skeptical of Clinton’s candidacy.

And while it remains unclear who in the campaign ordered Stone to seek out contact with Wikileaks to get “the emails,” Trump made frequent and vigorous use of what Wikileaks had provided.

Trump referenced the scrutiny then-DNC Chairwoman Debbie Wasserman-Schultz had received for her apparent preference for Clinton in the hacked emails.

“What she was was Hillary Clinton’s flunky,” Trump said at the North Carolina rally. “The system’s rigged and she was rigging the system for Hillary.”

At the same event, he asked his followers, “Wouldn’t it be nice if we got along with Russia?”

It wasn’t just Trump who was capitalizing on the anti-Clinton sentiment the emails were stirring among Sanders supporters.

His son, Donald Jr. — in a July 24 interview roughly seven weeks prior had attended a Trump Tower meeting where he had been promised dirt on Clinton — fiercely rebuked the assertion of the Clinton campaign that Russia was behind the hacks to promote Trump.

“I can’t think of bigger lies, but that exactly goes to show you what the DNC and what the Clinton camp will do,” Trump Jr. said. “They will lie and do anything to win.”

Trump Jr. then suggested that the DNC had in fact leaked the anti-Sanders emails “to try to destroy him in the south.”

“It’s a rigged system, it’s disgusting and the people should be fed up, because when I heard it, I certainly was,” Trump Jr. said.

At the same time, for conservative ideologues, the holy grail of alleged “Clinton corruption” and secrecy were the 30,000 emails erased from the former Secretary of State’s private server.

The search for those messages motivated Stone, Corsi, and others in the orbit of the Trump campaign to jones for what Wikileaks might have had.

Later that week, on July 27, Trump held a rambling press conference where he said he hoped Russia would “find” the deleted Clinton emails.

“I think you will probably be rewarded mightily by our press,” Trump said.

On that same day, according to an indictment charging Russian hackers last July, the hacking operation attempted for the first time an unsuccessful spearfishing intrusion into emails account used by Clinton’s personal office.

“At or around the same time, they also targeted seventy-six email addresses at the domain for the Clinton Campaign,” the indictment said.