On Friday morning, President Donald Trump learned that his former national security adviser Michael Flynn had been charged with lying to the FBI by reportedly seeing news reports.

It was a shock but not necessarily a surprise.

For weeks, Trump has vented privately to advisers and confidants about his anxiety over signs that Flynn had flipped. He noted the possibility that Flynn had “turned on me,” three sources close to the president independently recall him saying. These sources had relayed details of these conversations to The Daily Beast over the course of the past week.

Trump’s fears came into sharp focus this past month, as several media outlets began to report that Flynn appeared to be cooperating with special counsel Robert Mueller’s investigation into alleged Russian meddling in the 2016 election.

The president—an avid and voracious consumer of Twitter and cable news—began privately fuming, according to an administration official and two outside allies of Trump. Two of the three sources noted that it sounded at times as if Trump felt personally hurt by the prospect that someone whom he admired professionally and liked personally had potentially turned.

Sources said that President Trump’s flourish in his Thanksgiving speech to members of the U.S. Coast Guard—during which he said, “You never know about an ally. An ally can turn”—was intended as not-so-subtle jab at his former national security adviser.

At 10:22 a.m. ET on Friday, Flynn, wearing a gray suit, exited a black Suburban and walked silently through a gauntlet of cameras into a Washington, D.C., courthouse as reporters shouted questions. A man—standing behind a group of reporters next to a woman in a pink knit hat with cat ears—shouted, “Hold on, Putin loves you!” in Russian at the disgraced former national security adviser. Flynn’s heckler, who declined to give his name, wore a cat-ear hat. At one point, an Uber driver rolling past the stakeout honked his horn and shouted at reporters, “Tell Flynn to fuck himself!”

An hour or so later, Flynn put out a statement on the plea deal, saying, “I recognize that the actions I acknowledged in court today were wrong, and, through my faith in God, I am working to set things right.” Flynn said he made his “agreement to cooperate” with Mueller’s investigation “in the best interests of my family and our country. I accept full responsibility for my actions.”

After more than an hour inside the courthouse, Flynn exited as silent and as quickly as he entered. But the small crowd that had gathered outside jeered at him, screaming “traitor!” and “lock him up” as his SUV pulled away.

Following the Friday’s charge, White House allies continued to insist that the Trump campaign did not collude with the Russian government during the 2016 campaign. Though the charge against Flynn stems from his conversations with a top Russian government official, allies insisted that this didn’t point directly to efforts to sway the outcome of the election.

“It appears that Flynn, like Martha Stewart, did nothing wrong but lie to the feds,” Michael Caputo, a former Trump campaign aide and peripheral figure in the Russia investigations, said in a text message on Friday morning. “I’m unconvinced that today’s news proves Gen. Flynn has provided evidence of campaign collusion.”

The White House, meanwhile, appeared intent on going on the offensive, attempting to paint Flynn as a serial liar who harbored secret loyalty, or at least ties, to Trump’s enemies.

“Nothing about the guilty plea or the charge implicates anyone other than Mr. Flynn,” White House lawyer Ty Cobb said in a statement, referring to Flynn as “a former Obama administration official.”

“The false statements involved mirror the false statements to White House officials which resulted in his resignation in February of this year.”

But reports suggest that Flynn will testify that, at a minimum, he was instructed by Trump transition officials to make direct overtures to the Kremlin. His guilty plea is expected to result in testimony against those officials and, perhaps, Trump himself.

It was, in all, a chaotic and potentially monumental moment in the still-young Trump presidency, one that could precipitate months if not years of additional political pitfalls for the administration.

“It’s critical that we determine whether Flynn spoke with the Russians on his own initiative and who knew and approved of his actions,” said Sen. Dianne Feinstein (D-CA), who sits on both the intelligence and judiciary committees investigating Trump. “This is just one more proof point that these investigations must be allowed to continue without interference.”

Unlike other former campaign aides ensnared in the Russia scandal, Flynn’s proximity to the president cannot be dismissed. He was no mere coffee boy. Rather, he presided in the top echelons of the campaign and was even floated briefly as a possible vice-presidential candidate.

Flynn first found his way into Trump’s orbit as an outcast from Barack Obama’s administration. He had served the former president as head of the Defense Intelligence Agency. Fellow generals widely respected Flynn as one of the top intelligence officers of his generation. But even at DIA, he acted erratically, according to former intelligence and military colleagues, and was considered both a poor manager and unreliable interlocutor—critical factors that led to his downfall.

All of that intensified after Obama fired him. Flynn became a vocal critic of what he portrayed as a monolithic, violent “Islam” and a prominent booster of strengthening ties to Russia. He opened a consulting firm with ties to the Turkish government and was paid a hefty sum to give a speech at an anniversary party for RT, the Russia propaganda TV network—payments he initially failed to disclose to federal ethics officials after he joined the White House.

As the 2016 Republican primary got underway, Flynn advised several candidates on foreign policy matters. The Washington Post reported that he had phone calls with Trump during which, Flynn said, he came away impressed.

The feeling was apparently mutual. Trump leaned on Flynn as a surrogate and ultimately gave him a prime-time speaking role at the convention in Cleveland—during which Flynn led a “lock her up” chant directed at Hillary Clinton.

After the convention, Flynn continued stumping for the Trump campaign. And when Trump won the election, he was in prime position to cash in. Despite warnings from the Obama administration not to hire the guy, Trump named him his national security adviser.

In that post, Flynn took steps that looked to his administration colleagues uncomfortably like sidling up to Russia. In particular, he skirted the boundaries of legality by urging the military to expand a military-to-military communications channel designed to prevent mid-air conflict in Syria between Russian and American pilots. The Pentagon feared that Flynn would have the military violate a congressional prohibition on outright military cooperation with Russia. As well, Flynn aides on the National Security Council explored relaxing energy sanctions on Moscow—in exchange for nothing.

But Flynn didn’t last long. A few weeks into his tenure, it was revealed that he had not been truthful about conversations he’d had during the transition with Russia’s ambassador to the U.S., Sergey Kislyak, about sanctions relief. Justice Department officials warned the White House that Flynn could be compromised. Vice President Mike Pence complained that he’d been humiliated by unknowingly insisting that no such conversations had taken place. Eventually, enough pressure mounted that Trump had to cut him loose.

Trump remained a vocal defender of Flynn. He privately complained at the injustice perpetrated against Flynn, and how reluctant he had been to let him go from the White House. Even as federal investigators appeared to be targeting Flynn as part of the Russia probe, Trump hoped he would be able to re-hire his former national security adviser, as The Daily Beast reported in May. Trump even ignored his lawyers’ repeated warnings against contacting Flynn following the adviser’s ouster.

Some of Trump’s closest friends and aides, however, assured the president he had done the right thing firing Flynn. This included famous boxing promoter Don King, who said he directly told President Trump that “with all due respect, Mr. President, Flynn fired himself.”

Trump’s displeasure with the investigation led to a watershed moment in the post-election Russia drama that precipitated the later appointment of Robert Mueller. In late January, when Trump met with then-FBI Director James Comey, he told Comey, “I hope you can see your way clear to letting this go, to letting Flynn go. He is a good guy. I hope you can let this go,” the former FBI director later testified.

At the time, reports suggested that charges would not be brought against Flynn despite discrepancies in his statements to federal investigators. But Trump’s later firing of Comey led to the appointment of Mueller as special counsel, and Mueller apparently opted to pursue those charges. The comments to Comey marked a remarkable, if far from unique, instance of ill-advised statements from the president that would come back to bite him.

Mueller’s investigation, which reportedly has centered on Flynn’s son, Michael Flynn Jr., who also served on the presidential transition, has taken a heavy financial toll. His legal bills are expected to be well into the seven figures, The Daily Beast reported in September. His family has set up a legal defense fund to help cover some of those considerable expenses.

—with additional reporting by Jackie Kucinich, Spencer Ackerman, and Sam Stein