BOSTON (AP) — Democratic Attorney General Maura Healey has been elected governor of Massachusetts, making history as the nation’s first openly lesbian governor.

Healey, the state’s first woman and openly gay candidate elected to the office, defeated Republican Geoff Diehl, a former state representative who had the endorsement of former President Donald Trump.

Her election returns the governor’s office to Democrats after eight years of Republican leadership under the popular Gov. Charlie Baker, who opted not to seek reelection.

Healey and her running mate, Salem Mayor Kim Driscoll, were among three all-female governor/lieutenant governor tickets in the U.S. that began Election Day with a chance to become the first such pairing elected to lead a state.

The Republican all-female ticket of Sarah Huckabee Sanders for governor and Leslie Rutledge for lieutenant governor won in Arkansas. In Ohio, the ticket of Democrat Nan Whaley and running mate Cheryl Stephens lost to Republican Gov. Mike DeWine.

Healey was also one of two openly lesbian candidates who ran to be a governor in the country. Healey and Democrat Tina Kotek, a candidate for governor in Oregon, each began the day with a chance to become the first open lesbian elected governor of a state.

Healey addressed supporters at a downtown Boston hotel after her victory Tuesday night.

“To those who voted for me and to those who didn’t I want you to know that I’ll be a governor for everyone and I’ll work with anyone who’s up for making a difference in this state,” Healey said.

Healey also addressed the historic nature of her win.

“Tonight I want to say something to every little girl and every young LGBTQ person out there. I hope tonight shows you that you can be whatever, whoever you want to be and nothing and no one can ever get in your way except you own imagination and that’s not going to happen.” Healey said.

“I stand before you tonight proud to be the first woman and the first gay person ever elected governor of Massachusetts,” she added.

Diehl told supporters at a Boston hotel that he had called Healey to congratulate her on her win.

“The people of the commonwealth have spoken. I respect their choice and I ask everyone who has supported me and Leah to give her the same opportunity that I would have asked for if the shoe had been on the other foot,” he said, referring to his running mate Leah Allen.

“Despite the outcome, I’m proud of the race we ran,” he added. “We highlighted issues that are important for people across the state.”

Healey — elected eight years ago as the nation’s first openly gay attorney general — snapped what’s become known in Massachusetts as the “curse of the attorney general.” Since 1958, six former Massachusetts attorneys general have sought the governor’s office. All failed.

During the campaign, Healey pledged to expand job training programs, make child care more affordable and modernize schools. Healey has also said she would protect “access to safe and legal abortion in Massachusetts” in the wake of the Supreme Court’s decision overturning Roe v. Wade.

The 51-year-old has also checked off what she considers a series of accomplishments during her time as the state’s top law enforcement officer, including protecting students and homeowners from predatory lenders and suing Exxon Mobil over whether the oil giant misled investors and the public about its knowledge of climate change.

Healey also targeted OxyContin maker Purdue Pharma and members of the Sackler family over allegations they deceived patients and doctors about the risks of opioids.

During the campaign, the Democrat warned Diehl would “bring Trumpism to Massachusetts.” Diehl served as co-chair for former President Donald Trump’s first presidential campaign in Massachusetts and won his endorsement for governor in a state that roundly rejected Trump in 2016 and 2020.

Although Healey is the first woman in Massachusetts elected governor, she’s not the first to serve in the office. Republican Jane Swift, then lieutenant governor, became acting governor in 2001 when Gov. Paul Cellucci resigned to become ambassador to Canada. Swift was never elected governor.

Since 1991, Republicans had held the corner office at the Statehouse for all but eight years when Democrat Deval Patrick was governor.