The last time Sen. Susan Collins faced a Democratic challenger, she was considered practically invincible.
"No politician is ever bulletproof, but Collins is close," University of Maine political scientist Mark Brewer told the Portland Press Herald in 2013.
At that point, Collins had already won three Senate races, expanding her share of the vote each time. She went on to defeat her rival, former ACLU leader Shenna Bellows, with almost 70% of the vote.
Six years later, everything has changed.
Collins is in the race of her life against Maine's Democratic House speaker, Sara Gideon. With 3½ weeks to go, Collins is down in just about every poll as she seeks a fifth term from Maine voters.
To many Mainers, the answer has a lot to do with Justice Brett Kavanaugh.
Even as Senate Majority Leader Mitch McConnell pushes to confirm Trump's next pick for the Supreme Court, Judge Amy Coney Barrett, the fight over the last vacancy is continuing to shape the race for the Senate.
"Normally I am hesitant to ascribe too much to one particular vote that a legislator takes," Brewer said in a recent interview. "I think in this particular instance, her vote to confirm Brett Kavanaugh really has gotten the attention of a lot of people."
The Kavanaugh vote fits in with two other dynamics that Brewer has seen shape the race: Trump's deep unpopularity in the state and Maine's growing polarization.
Collins voted to confirm Kavanaugh in 2018, sealing his ascension to the top court by an historically slim margin.
Collins had been supportive of abortion rights, but in announcing her support for Kavanaugh, she rejected warnings from activist groups that he would threaten the court's reproductive rights precedents. That vote was the final straw for many on the left in Maine, where voters and politicians pride themselves on their ability to look beyond party lines.
It also prompted an effort to crowdfund money for Gideon, eventually providing a nearly $4 million boost to her once she gained the Democratic nomination. Gideon has raised more money than Collins in the unusually pricey contest, about $24 million compared with Collins' $17 million, according to the most recent data from the nonpartisan Center for Responsive Politics.
In the two years since the Kavanaugh vote, Collins has struggled to change the subject.
She has campaigned around Maine touting her accomplishments in the Senate and her bipartisan record stretching back to the early days of her career, working in the office of Rep. William Cohen, the moderate GOP congressman who would later represent the state in the Senate and become Defense secretary under Democrat Bill Clinton.
But the Kavanaugh vote has trailed her nonetheless, a linkage to the unpopular president that Democrats have tried to cement at every turn in the minds of Maine voters. In recent days, the Maine Democratic Party has begun posting "Trump Collins 2020" lawn signs.
"She is in a particularly hard position because she used to have a real sense of support from the women's community — there were folks who worked on choice, on women's rights, who used to be big defenders of Susan Collins," said Lanae Erickson, a politics analyst at Third Way, a center-left think tank. "The Kavanaugh vote just eviscerated her support with all of those people."
Amy Cookson, a spokeswoman in Maine for Planned Parenthood Votes, said the Kavanaugh vote "was a tipping point for many people who used to support Susan Collins and will not anymore."
Planned Parenthood was just one of the groups that had supported Collins but flipped to Gideon, citing the Kavanaugh vote. Others include the League of Conservation Voters and the Human Rights Campaign.
Gideon, who sponsored several bills last year protecting reproductive rights in Maine, has seized on Collins' support of Kavanaugh as well as the senator's votes in favor of other Trump appointees to the federal bench. An upcoming Supreme Court fight over the constitutionality of the Affordable Care Act has added to her ammunition.
Over the summer, after Kavanaugh voted unsuccessfully to uphold a restrictive Louisiana abortion law, Gideon posted on Twitter: "Do you still think Brett Kavanaugh believes Roe v. Wade is settled law, @SenSusanCollins?" On Monday, the second anniversary of Collins' announcement of her support for Kavanaugh, Gideon circulated an ad featuring health-care workers in the state condemning Collins for her vote, citing the case.
To many observers, the dynamic is much larger than a fight over the Supreme Court. It is also an illustration of the perils of running on the message of independence in a time of enormous party polarization.
That polarization "makes her position as a moderate harder to hold," said Brewer, who researches electoral behavior. "It has happened maybe even more so in Maine, and I think the transformation in Maine was more recent."
Brewer traces the rise of polarization in Maine back a decade, to the ascension of Gov. Paul LePage in 2010, the brash two-term Republican who has called himself "Donald Trump before Donald Trump became popular."
Two years after LePage's victory, Sen. Olympia Snowe, a Republican known for reaching across the aisle, announced she would not seek reelection despite being seen as a relatively safe incumbent, as the tea party faction appeared to be gaining traction in the state.
The practical effect of the polarization is that Collins cannot be seen to buck the president fully without losing Republican voters but must also somehow retain the Democratic voters who have been crucial to her successes and who despise Trump.
That balancing act has become even more difficult as the election nears. Collins, who publicly denounced Trump in 2016, has not said whom she is voting for this year. Pressed by Gideon at a debate last month, Collins said she didn't "think the people of Maine need my advice."
After Justice Ruth Bader Ginsburg died, Collins rebuffed Trump again, saying she did not support filling the seat until after the election. (Collins had said even before Ginsburg died that seating a new justice in October would be too close to Election Day.)
Rather than continuing to talk about Trump and Kavanaugh, Collins has been trying to shift the dialogue back to Maine. Collins notes that the Paycheck Protection Program included in the March stimulus bill that she helped author in the Senate has delivered billions to small businesses in the state, and helped sustain a quarter million local jobs.
Moreover, if the Republicans hold onto the Senate, Collins' seniority puts her in line to lead the influential Senate Appropriations Committee, a position that often provides financial perks to a lawmaker's constituents.
Pounding further on the local message, Collins has attacked Gideon recently for her roots, noting that she is a transplant from Rhode Island.
"I grew up in Caribou, I've lived in Bangor for 26 years. My family's been in Maine for generations. She's been in Maine for about 15 years and lives in Freeport," Collins said in an interview with Politico published Wednesday. "That's a big difference in our knowledge of the state."
While the Gideon campaign has alleged that Collins' time in Washington has alienated her from local interests, Collins has made the opposite point, arguing that her work in the nation's capital has delivered more than Gideon's legislative efforts at home.
"Speaker Gideon adjourned the Legislature more than 200 days ago and has been unable and even unwilling to negotiate a bipartisan compromise to bring it back in session," Collins spokeswoman Annie Clark said in an email.
"Despite her promises to take state level action to help small businesses back in April, Sara never delivered, and she ignored the state's struggling unemployment insurance system that continues to delay and confuse benefits for Mainers, who are desperate for help," Clark added.
In a statement provided to CNBC after this story was originally published, Gideon spokesperson Maeve Coyle responded that it was "clear that Senator Collins has changed and she's willing to say or do anything to stay there."
"Senator Collins is clearly desperate to distract from the fact that it's been over five months since the Senate has passed any coronavirus relief, not to mention her record of undermining Mainers' health care and rubberstamping 181 Trump judges," Coyle said in a statement.
Shenna Bellows, a Democratic state senator who represents a district that voted for Trump in 2016 and who challenged Collins in 2014, said Collins' work on the Paycheck Protection Program may not resonate with locals.
"Many of the small businesses in Maine very much appreciated the PPP, for example, and are grateful for that program, but there was also a sense that it was designed to benefit the biggest businesses," Bellows said.
She said the perceived elitism of the PPP pointed to a deeper problem, that she had tried to latch onto in her bid against Collins.
"There is a sense that things for working people have gotten much worse over the last 20 years. I think there's a sense of disillusionment," she said. "I think people have been really angry. The Kavanaugh vote was a good example, but also the votes for the huge tax cuts [in 2017], and her trying to have it both ways on the Affordable Care Act," Bellows said.
"I ran against her because I thought she wasn't being a strong enough leader on issues that really mattered to Maine, but I think that now voters are seeing the same thing."
With the Nov. 3 election looming, there's little time for Collins to turn things around. In averages of state polls, Gideon leads by about 4 points.
A wrinkle in the race that could prove consequential is that voting will be conducted via ranked choice, meaning voters will be allowed to rank the four candidates on the ballot — Collins, Gideon, and two independents — in their preferred order.
If no candidate receives a majority of the vote, then voters' second choices are counted. Most state polls show neither Gideon nor Collins securing 50% support. Lisa Savage, a liberal independent on the ballot, has encouraged her supporters to list Gideon as their second choice, which could be decisive.
Maine Republicans oppose ranked choice voting, which was crucial in the defeat of Republican Rep. Bruce Poliquin in 2018 by Democrat Jared Golden, who represents the state's 2nd Congressional District now.
But their legal efforts to stop the system have proved unsuccessful. On Wednesday, Justice Stephen Breyer turned back a petition from state Republicans urging the Supreme Court to halt ranked choice in the coming races.