BOSTON — When Attorney General Martha Coakley leaves office Tuesday, she’ll be ending a public career that’s spanned nearly two decades and propelled her into the top law enforcement job in Massachusetts.

Coakley also will be leaving behind a mixed political record that includes two high-profile losses.

In an interview with The Associated Press, Coakley said she has no regrets about her eight years as attorney general and is looking forward to her stint as a resident fellow at Harvard University’s Institute of Politics.

“I think it’s fair to say that my efforts at elected office are done,” Coakley said.

Beyond that, Coakley is keeping her options open.

She said she wants to continue her role as an advocate – particularly on human trafficking issues and mental health – and hasn’t decided if she will return to a legal practice, teach or become active in the nonprofit world.

One job Coakley said she’s not interested in is becoming a judge, even on the Massachusetts Supreme Judicial Court.

“That’s not something that particularly draws me,” she said.

Coakley, 61, has been a trailblazer, becoming the first woman elected district attorney in Massachusetts and the first to serve as attorney general.

Her attempt to continue that streak faltered, first when she lost a special election to Republican Scott Brown to fill the late Edward Kennedy’s Senate seat in 2010 and again last year when she narrowly lost a race for governor to Republican Charlie Baker.

Some have blamed the loss on the office, noting past attorneys general have also lost gubernatorial contests.

Coakley agrees that being attorney general is a tough job.

“Attorneys general are not traditionally popular politicians,” she said. “If you’re doing your job right, probably there are going to be people who don’t like the decisions you make.”

But she doesn’t blame her loss on Massachusetts’ “curse of the attorney general.”

“It was such a close race I think it’s hard to say there was one thing that might have made a difference one way or the other,” she said.

Coakley said she hopes her decision to run for re-election just months after the 2010 loss – and her decision to run for governor – inspires others to persevere.

“I hope that women will continue to seek out those challenges and understand that win or lose your voice is important and you have to kind of stay at it,” she said. “Having women at the table in positions where they add to the debate and make decisions is extremely important.”

Coakley said her most challenging job was as head of the child abuse unit under former Middlesex District Attorney Tom Reilly. She said the job taught her the complexity of problems that cut across society and require a multi-pronged response.

As attorney general, Coakley has grappled with many tough challenges.

She said she was able to anticipate some, pointing to her decision to file a first-in-the-nation lawsuit challenging the constitutionality of the federal Defense of Marriage Act

Others she couldn’t anticipate, she said, like the national foreclosure crisis. She considers her response to that a signature part of her legacy.

Coakley said she’s confident her successor, Attorney General-elect Maura Healey, is up for the job.