Democrat Maura Healey has won the race to become the state's next attorney general, filling the seat vacated by Martha Coakley.
Healey, a former assistant attorney general, took her party's nomination after a hard-fought primary against former state senator Warren Tolman.
Republican candidate John B. Miller, a veteran lawyer from Winchester, was unopposed for the GOP nomination. He sought to gain ground on Healey by running ads promising not to treat the position as a step toward higher office.
Healey, who served seven years in Coakley's office, will be the first openly gay state attorney general in the United States. She touted her experience challenging the federal Defense of Marriage Act and battling subprime lenders. And she noted that she took on the state's political establishment in her primary battle against Tolman.
She has an unusual background — she played professional basketball in Europe before attending law school.
The attorney general's seat is open because Coakley is seeking the governor's office, as her two most recent predecessors did before her.