Goldman Sachs’ top lawyer, Kathryn Ruemmler, resigned Thursday after newly released Justice Department documents revealed the depth of her relationship with convicted felon Jeffrey Epstein, intensifying scrutiny on the Wall Street powerhouse.

“My responsibility is to put Goldman Sachs’s interests first,” Ruemmler, 54, said in a statement confirming her resignation.

>100 SECRET PHOTOS FROM JEFFREY EPSTEIN’S FILES – SLIDESHOW

The Justice Department last month released thousands of pages of emails and other materials that detailed years of correspondence between Ruemmler and Epstein, who died in 2019 while awaiting federal trafficking charges. The documents undercut prior claims that their relationship was strictly professional.

In one 2015 email, Ruemmler wrote to Epstein, “I think the point is that if she was underage, she could not legally consent to engaging in prostitution.” The email was part of a broader exchange in which she discussed legal distinctions involving underage victims.

Other emails showed Ruemmler suggesting legal strategies. In one message, she wrote that Epstein’s lawyer could push an accuser into a “perjury trap.”

The tone of the correspondence at times appeared informal. While interviewing for her role at Goldman in 2019, Ruemmler emailed Epstein, “Am totally tricked out by Uncle Jeffrey today!” She signed some emails “xoxo” and referred to him as “sweetie” and “Uncle Jeffrey.”

Goldman Sachs CEO David Solomon said he was surprised by her decision to step down. “Hindsight is a very, very funny and a very, very powerful thing,” Solomon said Friday in an interview with CNBC. “A lot of — all of — this happened before she was at Goldman Sachs, and 10 years ago.”

He added, “I’m proud of the way Kathy has handled this, and the way we have worked through it.”

Until Thursday, Goldman’s leadership had publicly supported Ruemmler, even as coverage of the emails mounted. In an all-staff message announcing her departure, Solomon said she would remain through June 30 to “effect a smooth transition,” according to The New York Times.

Before joining Goldman in 2020, Ruemmler served as White House counsel under Barack Obama and later worked at Latham & Watkins. Her resignation follows renewed fallout for high-profile figures whose past associations with Epstein have resurfaced through court filings and investigative reporting.