Former US Attorney Alex Acosta has resigned in disgrace from his post as Labor secretary amid a tidal wave of scrutiny over his handling of the Jeffrey Epstein child sexual abuse case in 2008. Acosta has faced significant criticism for the cushy plea deal he secured for the pedophile financier in the months since the Miami Herald reported on the case, but the pressure intensified this week after Epstein was indicted for sex trafficking and conspiracy. (Epstein has pleaded not guilty.) On Thursday, Acosta defended his handling of the case during his time as a prosecutor in Florida, as did President Donald Trump, but that didn’t quell the furor. Less than 24 hours later, he tendered his resignation.

“I do not think it is right and fair for this administration’s labor department to have Epstein as the focus rather than the incredible economy we have today,” Acosta told reporters outside the White House on Friday morning, announcing his exit.

According to the president, it was Acosta’s decision to leave his post. “This was him, not me,” Trump told reporters. But a senior White House official suggested to CNN that the decision did come from the president, who was frustrated with Acosta and concerned that the scandal could cast a pall over his 2020 re-election bid. “There would just continue to be disclosures,” the official said. “There would be questions in this town and on the trail.” Still, Trump was effusive in his praise for Acosta, and described questions about the unusual plea agreement as a political attack. “He made a deal that people were happy with and then 12 years later, they’re not happy with it,” Trump said Friday. “The fact is, he has been a fantastic secretary of labor.”

Acosta was tapped to serve as Labor secretary in February 2017 after Trump’s previous pick, Andrew Puzder, withdrew his nomination over accusations of domestic abuse. (Puzder denies the allegations.) He mostly stayed out of the spotlight during his tenure, but became a subject of intense criticism after the Herald renewed scrutiny into the plea agreement that allowed Epstein to avoid what could have been a life sentence for sexually abusing young girls. Acosta, the paper’s investigation found, was directly involved in cutting the unusual deal that required Epstein to serve just 13 months in a county jail, which he was allowed to leave for work, and register as a sex offender. The deal also allowed Epstein to skate on federal charges and granted immunity to his unnamed co-conspirators.

After Epstein was arrested Sunday and charged with sex trafficking minors, Acosta attempted to defend the shady deal: “The goal here was straightforward: put Epstein behind bars, ensure he registered as a sexual offender, provide victims with the means to seek restitution, and protect the public by putting them on notice that a sexual predator was in their midst,” he said. But his explanation raised more questions than it answered, and it seemed only a matter of time before he was to finally get his walking papers. Still, he insisted during the press conference that his relationship with Trump remained “outstanding,” and the president himself suggested as recently as Tuesday that he planned to stand by his embattled Labor secretary. “He’s been just an excellent secretary of Labor,” Trump told reporters this week. “He’s done a fantastic job.” But Trump also left himself some wiggle room, adding that “we’ll look at it very carefully,” referring to Acosta’s handling of the plea deal.