It’s been a very good week for Joe Biden. The former senator and vice president is the clear frontrunner in a crowded Democratic field for 2020. His poll ratings and campaign fundraising surged after he announced his presidential run last week.

One of Biden’s biggest assets is his close association with Barack Obama. He may not have the former president’s endorsement yet (Biden says, unconvincingly, that he didn’t want it), but Joe knows how popular Obama still is and how much his candidacy benefits from that reflected glow. Expect him to talk a lot about the Obama-Biden years.

Anything that undermines the 44th president’s legacy hurts all Democrats, and Biden most of all. That’s the danger posed by Attorney General Bill Barr’s commitment to investigate how the massive, prolonged investigation into “Trump-Russia collusion” began, whether it was conducted properly, and how information from it was illegally leaked to the media.

The collusion probe was begun by the Obama-era FBI and Department of Justice, led respectively by James Comey and Loretta Lynch, and by U.S. intelligence agencies, working with their foreign counterparts. It culminated, after President Trump fired Comey, with the appointment of Special Counsel Robert Mueller. When Mueller’s investigation found no illegal cooperation between Trump’s campaign and Russia, Republican lawmakers demanded to know a lot more about how the FBI began its counter-intelligence investigation, how it morphed into a criminal investigation, and whether it was conducted fairly and legally. Key Republicans on the House Intelligence Committee claimed that officials within the FBI and DoJ had violated the law, corrupted their agencies, and weaponized the most powerful tools of U.S. intelligence and law enforcement for partisan political goals.

In testimony to the Senate Wednesday, AG Barr said he could not explain why Comey’s FBI launched the counter-intelligence investigation, but that he intended to find out. He has assembled a team to do just that. Another investigation is looking into illegal leaks from the FBI and DoJ during the Comey-Lynch years. Finally, Inspector General Michael Horowitz is completing a major inquiry into the surveillance warrants used to spy on Americans during the “Trump-Russia” investigation. Those warrants were issued by the secretive Foreign Intelligence Surveillance Court and relied on evidence presented as “verified and complete” by Lynch’s DoJ and Comey’s FBI.

It was not verified, and it was not complete. The court was not given exculpatory information. Nor was it told that Hillary Clinton’s campaign and the Democratic National Committee had commissioned and paid for Christopher Steele’s dossier, which was vital to the FISA applications. Was the dossier verified, as required? No. In fact, Barr testified Wednesday that he could not definitively say whether it might be Russian disinformation.

Spying on a political campaign is “a big deal,” as Barr said in earlier testimony. It’s an even bigger deal when the executive branch is controlled by one party and is spying on its political opponents. Barr and Horowitz are determined to get to the bottom of this malfeasance. Expect criminal referrals when they do.

Perhaps the most sensitive question is how high up this goes. Text messages between two key figures in the Comey FBI, Peter Strzok and Lisa Page, say it goes very high, indeed. An Aug. 5, 2016 message from Strzok tells Page that “the White House is running this.” We don’t know yet if that’s true, or who might be involved, but the message suggests how significant the political stakes were then — and are now.

How do the Barr and Horowitz investigations affect Biden? In at least three ways. First, they could strengthen President Trump’s claim that he was the victim of dirty tricks by Obama appointees in law enforcement, intelligence, and national security. Second, they are likely to tarnish the reputation of the Obama administration, which is one of Biden’s strongest assets. Finally, if the Obama White House was directly involved (and we simply don’t know at this point), then Biden will have to distance himself from everyone involved. That’s obviously his best move. But it comes at a price. It makes him look like a marginal or clueless figure on a crucial foreign-policy issue, which Biden has always claimed as his area of expertise. (He headed the Senate Foreign Relations Committee.)

It’s not surprising, then, that Biden quickly joined the chorus of Democrats demanding Barr resign as attorney general. That won’t happen. What will happen is an intense, nasty campaign to smear Barr and distract from the investigations he and Horowitz are conducting. The media may bite, as they did for two years of Russia-collusion stories, but Barr won’t quit, and he won’t be distracted. He is determined to find out what happened during this exhaustive hunt for a non-existent crime of cooperating with a hostile foreign power. The results will affect the Obama legacy and the 2020 election. And they could well affect Joe Biden’s campaign to oust Donald Trump.