Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

NEW YORK — For a decade, Barbara Underwood was an apolitical force in New York, quietly serving as solicitor general before getting an unexpected promotion to become the state's first female attorney general.

Now, the 74-year-old Democrat, who abruptly ascended to the office after a scandal felled her predecessor, is going back to her old job after a nearly eight-month turn in the spotlight.

This time she will be serving under another woman, Letitia James, another Democrat who was sworn into the job in Albany late Monday night.

Underwood will be able to look back on a record as a leading antagonist of President Donald Trump — if only briefly.

She sued to put Trump's charitable foundation out of business, accusing him of running it as a wing of his private businesses and political campaign. Underwood also used the courts to challenge his administration on a multitude of policy fronts, including opposing its push to add a citizenship question to the 2020 census.

Those attacks earned Underwood scorn from Trump. In a tweet, he bristled that she "does little else but rant, rave & politic against me."

Underwood, who has never held elected office and declined to run for the attorney general's job, always said that politics had nothing to do with it. And she said she's content to be going back to the lower-profile job of solicitor general.

"I like that role, and so I'm happy to go back to doing it," she told The Associated Press in a recent interview. "I have come to like this too. It's not that I'm eager to leave this, but I'm very happy to be going on to something that I know I like."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Underwood was appointed attorney general by the state legislature in May after the surprise resignation of Eric Schneiderman, who quit just hours after The New Yorker posted a story in which four women accused him of slapping or choking them. Schneiderman later apologized to his accusers; the special prosecutor who investigated the allegations declined to bring criminal charges.

Underwood said Schneiderman's May 7 resignation came without warning.

When the night started, she said, all she and her colleagues knew was that a news article about him was about to be published.

"I had no idea that this particular event was going to happen until it happened," Underwood said.

They went to a bar to wait for what came next. Schneiderman announced he would resign and a colleague told Underwood: "It looks like you're going to be the next attorney general. Are you ready?"

"I thought, 'OK here we go. Let's not lose any time. Let's not lose any morale, any energy," Underwood said. "There was no time lag for me, and I didn't want there to be a time limit for anyone else."

She said the big change was having to deal with the media.

Underwood didn't seek election to a full term, clearing the way for James, the New York City public advocate, to seek the office. Not facing a campaign likely gave Underwood more flexibility, former state attorney general Dennis Vacco said.

"She had an independence and a freedom that wasn't tethered to the will of the people and the ballot box," Vacco, a Republican said. "She leaves a rather stable environment for AG-elect James to come into now."

James, who also made history as the first black woman elected to statewide office in New York, praised Underwood for doing an "excellent job."

Aside from challenging Trump, Underwood negotiated civil settlements with hospitals that she accused of wrongly billing rape victims for evidence kits, sued Exxon, claiming that it was misleading investors about climate change, and investigated phony public comments submitted to the Federal Communications Commission over internet regulation.

The job is the high mark, so far, of a career that Underwood said didn't always "go in a straight line."

She has taught law at Yale and was a law clerk for Thurgood Marshall, the first black Supreme Court justice, and for David Bazelon, the former chief judge of the D.C. Court of Appeals. She worked as an assistant district attorney and federal prosecutor in Brooklyn, and was a top deputy to U.S. Solicitor General Seth Waxman during President Bill Clinton's administration. She was also the nation's acting solicitor general for six months in 2001, the first woman in that post.

Underwood has argued cases before the U.S. Supreme Court 20 times.

New York Gov. Andrew Cuomo, who hired Underwood as solicitor general in 2007, praised her "brilliant legal mind" and professionalism.

Underwood said it was an honor to have gotten a chance to serve.

"It is a special honor to be in that role right now when so many people are looking to this office to protect them and their rights. I feel privileged to hold this role and to do this important work and I'm glad that people appreciate it."