Maine’s Republican governor Paul LePage caused a huge controversy two weeks ago when his profanity-laced voice message attacking a Democratic state legislator was aired nationally. Some analysts thought it might force the two-term state executive to step down.

But it’s barely hurt LePage at all. And part of the reason is that Maine, especially the northern part of the state, has gone conservative in a big way since 2011, when LePage took office. He hasn’t always been popular but the state is clearly trending away from the Democrats and could end up in the GOP win column in November.

Clinton led by as much as 11 points just a month or so ago. But the lead has shriveled, and now polling analysts have switched Maine’s status from leaning “Clinton” to “toss up.” The latest polls released this week show Trump and Clinton in a statistical dead heat, 37%-37% with 11% for Libertarian Gary Johnson and 10% undecided

It’s a remarkable turnaround for a state that hasn’t gone Republican since 1988, when George H.W. Bush won 56% of the vote over Democrat Michael Dukakis.

Both men had New England ties but Bush had vacationed regularly for years in Kennbunkport, where he was well-known to locals and his visits made the news.

He was also the kind of moderate Republican that Maine residents usually prefer – and typically elect locally, too. The state’s senior senator, Susan Collins, is a committed centrist, and has often defied her party’s conservative wing by reaching to Democrats to forge bipartisan alliances. In the early years of the Obama administration, she was a key swing vote in the Senate on issues ranging from immigration to Obamacare.

But that was before the rise of the Tea party movement in 2010. Maine’s branch of the movement was a driving force behind LePage’s election, just as counterpart campaigns in Wisconsin, New Mexico and elsewhere led to conservative takeovers of their executive mansions, too. But LePage’s razon-thin victory in a plurality — which was repeated in 2014 when he received less than 50% of the vote in a three-way race — has thrust him into one battle after another with hostile Democrats and even some Republicans, who have resisted his attempts to rollback the state’s environmental protection laws and to eliminate the state income tax.

His tenure as governor has been erratic – and bizarre. He promised to block several dozen Democratic-sponsored laws but somehow forgot to sign the vetoes – and he failed to convince the state Supreme Court to give him a second chance. So the laws ended up getting enacted. Democrats, and even many Republicans, have called him a “national embarrassment,” but he has steadfastly refused to step down.

Many of LePage’s outbursts can only be described as “Trumpian.” He once told the NAACP to “kiss my butt” when the group criticized his refused to attend the annual Martin Luther King celebration. And when state environmental groups warned that water bottles containing the toxin Bisphenol A could damage female hormones, he joked that some women might end up “growing beards.”

So how has LePage survived? For one thing, Maine’s economy is hurting badly. The state’s heavily dependent on manufacturing — especially of wood and paper products — which the recession and global competition have damaged badly. Maine’s unemployment rate is improving but its growth rate is one of the worst in the nation. After eight years of Obama, a growing number of voters think it’s time for a change.

Still, the state has just 4 electoral votes, and they are assigned in an unusual way. Two go to the candidate that wins the popular vote statewide, while the remaining 2 are split between the winner of each of Maine’s two congressional districts, one in the north (CD-2), the other down south (CD-1). Currently, Trump has a lock on Maine CD-2, while Clinton leads by a much smaller margin in CD 1, but the state as a whole is beginning to trend toward Trump.

Symbolically, this is already a huge blow to Clinton. Obama twice won by 15 points here and Maine was never expected to be competitive in 2016. And even a swing of just 2-4 electoral votes could matter in November. In some hypothetical scenarios, Clinton squeaks by Trump with 271-273 votes. That means a surprise loss might well cost her the election.