When Ayanna Pressley took the microphone Wednesday morning celebrating her upset victory, a panoply of top state Democratic leaders stood behind her, smiling and applauding.
But only one of them, Attorney General Maura T. Healey, had stood with Pressley the day before, when she was just an insurgent challenger to a 10-term congressman backed heavily by the political establishment.
By breaking with most party leaders, Healey, already considered one of the state’s most popular politicians, boosted her Democratic political stock, and ended up on the right side of a history-making race.
After endorsing Pressley in July, Healey campaigned for the city councilor several times, lending her star power to the cause when polls showed Pressley as the underdog.
Healey’s backing was all the more striking given the political heavyweights — such as Mayor Martin J. Walsh, Representative Joe Kennedy III, and former governor Deval Patrick — who lined up behind the incumbent, Michael E. Capuano of Somerville.
“It reinforces that she’s a big part of the new wave,” said Maurice T. Cunningham, a political science professor at the University of Massachusetts Boston, referring to the surge in progressive, women candidates running for office this year. “Usually I think we’re getting caught up in the day to day, but there’s something different here.”
Wednesday morning, at a Democratic Party unity event, Pressley, a Boston resident and Chicago native, seemed to reference the forces that had been arrayed against her.
“There are so many reasons why so many believed — and might still believe — why I have no business standing at this podium. Because this is a tribal, parochial place, and this hasn’t always been my home,” she said, as Healey stood directly behind her right shoulder.
Healey’s endorsement of Pressley was a gamble. It meant she was going against Capuano, an incumbent who shares Healey’s progressive political views. Like Healey, he has advocated strongly against President Trump’s policies. And he has brought home federal dollars that have helped Healey’s hometown of Boston and the broader state.
But the attorney general’s nod was also a matter of loyalty.
Pressley had endorsed Healey when Healey was an outsider waging her own uphill primary battle in 2014 against an establishment-backed Warren E. Tolman, a former state senator whose brother leads the Massachusetts AFL-CIO. Among the establishment figures backing Tolman in that primary for attorney general: Walsh.
“Healey knows what it’s like to be outspent, outgunned, outendorsed, outadvertised, outeverything — and yet still prevail,” said Mary Anne Marsh, a Democratic analyst.
There was loyalty, too, in Walsh’s backing of Capuano. The congressman endorsed Walsh in his successful 2013 mayoral bid.
Both Healey, 47 and up for reelection this year, and Walsh, 51 and up for reelection in 2021, are seen as aspirants for higher office. The political scuttlebutt is both may run for governor in 2022.
And both Healey and Walsh have growing state and national profiles. The attorney general has repeatedly sued the Trump administration, sometimes placing her at the vanguard of attorneys general across the United States.
Walsh recently visited Iowa, a presidential proving ground (he says he was there to talk to working-class people and boost Democratic candidates). And the mayor campaigned in a Lowell-anchored congressional district for Dan Koh, his former chief of staff, who came up short in preliminary results but has not conceded the race.
Both Walsh and Healey made some endorsements in Tuesday’s Democratic primary that worked out and others that did not. Both, for example, were behind liberal Jamaica Plain state Representative Jeffrey Sánchez, who lost to a challenger from his left.
Even though Walsh backed Capuano, and marshaled his political machine to help him, the congressman lost the city of Boston 64 percent to 36 percent, according to preliminary results.
“I don’t think this will do lasting damaging to Walsh . . . but it does demonstrate the limits of a Boston mayor’s appeal. People really like Marty Walsh,” Stonehill College political science professor Peter N. Ubertaccio said, “but it doesn’t mean they’re going to listen to him.”
Walsh aides say the mayor has a great working relationship with both Pressley and Healey — and that it will continue.
For his part, the mayor said his endorsement of Capuano “was a friendship thing.” After the Democratic unity event during which he praised Pressley, he told reporters, “You pick sides and then you go with — whatever happens at the end of the day, you come together.”
Asked whether he had misread the electorate, he said, “I didn’t misread anything. There’s no question, I didn’t misread anything.”
At the party event in Boston, Healey introduced the woman of the moment.
“At her core, she is a person of tremendous integrity, tremendous conviction, and tremendous empathy,” Healey said of Pressley. “I was not the least bit surprised by yesterday’s result.”