President Donald Trump speaks to members of the media with Secretary of Labor Alex Acosta on the South Lawn of the White House, Friday, July 12, 2019, before Trump boards Marine One for a short trip to Andrews Air Force Base, Md. and then on to Wisconsin. (AP Photo/Andrew Harnik)

WASHINGTON (AP) — Labor Secretary Alexander Acosta said Friday he is resigning following renewed scrutiny of his handling of a 2008 secret plea deal with wealthy financier Jeffrey Esptein, who is accused of sexually abusing dozens of underage girls.

President Donald Trump, with Acosta at his side, made the announcement as he left the White House for a trip to Wisconsin and Ohio. The president said Acosta had been a “great” labor secretary.

“I hate to see this happen,” Trump said. He said he did not ask Acosta to leave the Cabinet.

Acosta said his resignation would be effective in seven days. Acosta said he didn’t think it was right for his handling of Epstein’s case to distract from his work as secretary of labor.

“My point here today is we have an amazing economy and the focus needs to be on the economy job creation,” Acosta said.

Acosta was the U.S. attorney in Miami when he oversaw a 2008 non-prosecution agreement Jeffrey Epstein. Epstein avoided federal charges, plead guilty to state charges and served 13 months in jail. Similar charges recently filed against Epstein by federal prosecutors in New York had put Acosta’s role in the 2008 deal under renewed scrutiny.

Top Democratic lawmakers and presidential candidates had demanded that Acosta resign over his handling of the agreement, which a federal judge has said violated federal law because Acosta did not notify Epstein’s victims of the arrangement. The Justice Department has been investigating.

Trump had initially defended Acosta but said he’d look “very closely” his handling of the 2008 agreement.

The deal came under scrutiny earlier this year following reporting by the Miami Herald.

Epstein, 66, reached the deal to secretly end a federal sex abuse investigation involving at least 40 teenage girls that could have landed him behind bars for life. He instead pleaded guilty to state charges, spent 13 months in jail, paid settlements to victims and is a registered sex offender.

Acosta had attempted to clear his name, and held a news conference — encouraged by Trump — to defend his actions. In a 50-plus-minute lawyerly rebuttal, Acosta argued his office had secured the best deal it could at the time and was working in the victims’ best interests.

“We did what we did because we wanted to see Epstein go to jail,” he said, refusing to apologize for his actions. “We believe that we proceeded appropriately.”

Pressed on whether he had any regrets, Acosta repeatedly suggested that circumstances had changed since then.

“We now have 12 years of knowledge and hindsight and we live in a very different world,” he said. “Today’s world treats victims very, very differently,” he said.

After federal attorneys in New York announced the new charges against Epstein this week, Acosta tweeted that he was “pleased” by their decision.

“The crimes committed by Epstein are horrific,” Acosta tweeted. “With the evidence available more than a decade ago, federal prosecutors insisted that Epstein go to jail, register as a sex offender and put the world on notice that he was a sexual predator.”

“Now that new evidence and additional testimony is available, the NY prosecution offers an important opportunity to more fully bring him to justice,” he said.

Acosta, the nation’s 27th labor secretary, took on the role officially in early 2017, leading a sprawling agency that enforces more than 180 federal laws covering about 10 million employers and 125 million workers. He was confirmed in the Senate 60-38.

But Acosta had frustrated some conservatives who had been pushing for his ouster long before the Epstein uproar. Among their frustrations were Acosta’s decisions to proceed with several employment discrimination lawsuits and to allow certain Obama holdovers to remain on the job.

Acosta is a former federal prosecutor and civil rights chief. Before joining the administration he was dean of the Florida International University law school.