“We have a mandate to enforce the laws protecting people against discrimination, protecting workers, protecting against pollution,” she said. “And at a moment when all of those protections seem to be under attack at the federal level, it feels especially important and satisfying.”

“But I don’t bring an alpha-male personality for sure,” she added. “I think I bring the ability to bring people together and get consensus and offer help and guidance that doesn’t threaten them. Is that because I’m a woman? I don’t know. But it feels connected to something a lot of women are socialized to do, which is to help rather than compete.”

When Ms. Underwood started her career in the 1970s, hired by Yale Law School after clerking for Thurgood Marshall, the Supreme Court justice, she was one of a handful of women on the faculty. But after 10 years, she shocked her ivory-tower colleagues by giving up her tenured post to join the Manhattan district attorney’s office before moving to the Brooklyn district attorney’s office.

There, she specialized in appeals, which exposed her to a wide range of cases and allowed her to mentor younger lawyers. Perhaps her most enduring work was writing a brief on jury challenges that paved the way for the Supreme Court case Batson v. Kentucky, which outlawed the practice of pre-empting jurors based on race.

In 1993, after a stint in the Queens district attorney’s office, Ms. Underwood took a job as chief assistant under Mr. Carter in the United States attorney’s office in Brooklyn. She was instrumental in shaping the prosecution of Lemrick Nelson Jr., who was eventually convicted of violating the civil rights of a Hasidic scholar killed during the Crown Heights violence in 1991. She also worked on the high-profile police brutality case of Abner Louima, a Haitian immigrant who was brutalized with a broken stick in a police station bathroom in 1997.

“She was our legal guru,” said Alan Vinegrad, a former federal prosecutor who worked on both cases. “She had broad prosecutorial interests, but if you had to find a pattern, it would be a commitment to equality and civil rights.”

In 1998, Ms. Underwood was named the principal deputy solicitor general under Mr. Waxman, her former student at Yale. After the change in administration in 2001 and the departure of Mr. Waxman, she served six months as the acting solicitor general — the first woman to hold that job. In her time there, she argued before the Supreme Court to hold banks accountable for lending violations and to force utilities to cut their emissions.