When Joe Manchin heard rumblings that West Virginia Gov. Jim Justice was planning to switch parties and become a Republican, the Democratic senator called his friend to try to talk him out of it.

"I just disagree, and I wish you wouldn't change," Manchin recalled telling Justice, who just nine months earlier had been elected as a Democrat on the same day Donald Trump won the state by 42 points. But the governor's mind was made up, and soon he was sharing a stage with the president, announcing his defection -- or rather, his return -- to the GOP, insisting that the Democrats had left him.

The change cast a spotlight on the last major Democrat left standing in the state, who faces the most challenging campaign of his career next year in Trump country.

If Washington, D.C., is a swamp, Sen. Manchin might be something of a colorful rare bird, able to both paddle through the water and fly above the muck. While he has made a brand out of straying from the flock, he remains a loyal Democrat. A West Virginia species, though. And the difference is key to his future in public office.

"I’m a lifelong Democrat. I'm comfortable as a Democrat," Manchin told RealClearPolitics in an interview. But, he added: "In West Virginia, I'm not comfortable as a Washington Democrat, because they've gone more urban."

In the ever more partisan and polarized capital -- where being a Democrat means vehemently opposing all things Donald J. Trump -- Manchin is a relic of an era when relationships were currency and Democrats were the only party in town for working-class people. Whether he becomes an artifact to be studied by political archeologists tracing the transformation of political parties will be determined next year.

The Mountain State lawmaker is one of a handful of Democratic incumbents campaigning to keep their seats in red states Trump won. On paper, he is considered the most vulnerable: West Virginia delivered Trump one of his largest margins of victory, second only to Wyoming, and formidable GOP challengers have already lined up. But in reality, Manchin is among the best positioned to withstand the headwinds: He is a known commodity in his state, hails from a family of public servants, and enjoys high ratings. He has a proven track record in tough political climates.

If Manchin wins re-election next year, it won't be because of Democratic voters. But some would interpret a loss as a death knell for the party, which is aiming to regain working-class voters it has lost over the years. His re-election will be a test of the toxicity of the national Democratic Party brand.

"Chuck Schumer understands very well that if we can't win in rural America, he’ll be in the minority the rest of his life," Manchin said, referring to the Senate Democratic leader from New York.

Schumer, the face of the loyal opposition in Congress, appointed Manchin to a leadership position in the upper chamber to serve as a sort of Trump whisperer and conduit to a constituency that had abandoned the Democrats — or, in their telling, had been left behind by the party. His opponents will use his proximity to Schumer and his endorsement of Hillary Clinton as an anchor, and as evidence of a West Virginian gone Washington. But Manchin sees himself as an independent Democrat, able to accomplish more in Trump's Washington than in Obama's.

Trump's Democrat in Washington

Manchin says he has spoken with Donald Trump more times in six months than he did with Barack Obama in six years. He visited Trump during the transition and was briefly considered for a Cabinet position. The lawmaker has voted with the president 54 percent of the time, more than any of his Democratic colleagues, according to analysis by the website 538.

He supported most of Trump's nominees, including Jeff Sessions, who was vilified by the Democrats in Congress. And, along with his delegation, he has been able to notch some legislative wins, including securing a health benefits package for coal miners and legislation in the Senate aimed at opioid addiction. He recently called the White House to congratulate new Chief of Staff John Kelly and say he was looking forward to working with him.

But the senator hasn't been concerned about bucking the president, either. He voted against Betsy DeVos for education secretary, despite lobbying from Republicans. And he held with Democrats in opposing the Obamacare repeal bill, even as his GOP colleagues in his state voted in favor. He has also opposed repeal of some labor regulations and the repeal of government funding for groups such as Planned Parenthood.

Manchin welcomed Trump's visit to West Virginia last week with a conciliatory statement and identified tax reform as a key area of common ground. He declined to sign a Democratic letter listing party demands on taxes.

Notably, Trump did not mention Manchin's name during his speech, in which he criticized the Democratic Party. Whether that was a strategic decision or a missed opportunity, it benefited the senator.

"Joe Manchin is a man without a party," said West Virginia Republican Party Chairman Conrad Lucas. The chairman, who is in his 30s, grew up in a heavily Democratic area of the state, "and the thought of the GOP controlling everything seemed like a pipe dream."

Politics Shifting Like Sand

Indeed, the political realignment of West Virginia has been swift. Over the past three years alone, Republicans have taken over the state legislature and almost the entire congressional delegation. Last week, the party added a governor. Shelley Moore Capito's victory in 2014 marked the first time in 55 years a Republican had been elected to the U.S. Senate. She filled the seat Jay Rockefeller held for three decades before retiring. Capito's father, former Gov. Arch Moore, was a lone Republican in a sea of Democrats in the 1970s and 1980s.

West Virginians trace the shift to 2000, when voters chose a Republican presidential candidate for the first time since 1984. Democrat Al Gore, who would go on to become a leading environmentalist, took the state for granted after Bill Clinton won it twice. George W. Bush, however, saw an opening, and voters there took kindly to the fact that he made an effort. They have been voting Republican in presidential contests ever since. Last year, Trump won the largest share of the vote in the state's history since Abraham Lincoln, who had admitted West Virginia into the Union.

"West Virginia in some ways is tailor-made for the Trump messaging in that West Virginia feels like it is the butt of a lot of national jokes," said Mike Plante, a Democratic political consultant in the state. The message from Trump, a billionaire from New York City, spoke to "people who have felt disrespected and disenfranchised and looked down upon."

Twenty years ago, Plante worked for Charlotte Pritt, who defeated Manchin in the Democratic primary for governor by running to the left and painting her opponent as a centrist. Manchin declined to endorse her in the general election, and his allies formed "Democrats for Underwood" in support of the Republican, Cecil Underwood, who won.

Four years later, Manchin was elected secretary of state and won the governor's race in 2004. He was elected to the U.S. Senate in 2010 to fill the seat of Robert Byrd, who died in office. In 2012, he was re-elected with 60 percent of the vote, while Obama lost the state by nearly 30 points. Manchin released an ad that year that touted his National Rifle Association endorsement and featured him shooting a bullet through the cap and trade bill.

Democrats in the state point to the 2012 election as evidence of Manchin's ability to win despite a Republican tide. "Joe has always carved out for himself a different identity from the national Democratic Party and has defined himself as more a West Virginia Democrat than a Washington Democrat," Plante said. "Anybody that sells Joe Manchin short runs the risk of having egg on their face on Election Day."

But even Democrats here don't discount how quickly the sands are shifting, and how the national party’s interests contrast with those of the locals.

"In Appalachia, the Democratic brand became an urban brand and about urban issues," said Stephen Williams, the Democratic mayor of Huntington, where Trump visited last week. "We have issues here ... very different from issues in the large cities.”

A West Virginian Who Happens to Be a Democrat

Voter registration in West Virginia still favors Democrats, but the party's totals have gradually declined. Around this time last year, roughly 46 percent of state voters were registered as Democrats, compared to 30 percent Republican. Now, about 44 percent are Democrats and 32 percent are Republicans. The share of independent voters has also ticked up slightly.

Most Democratic officials in the state might describe themselves the way Mayor Williams does: "I'm a West Virginian who happens to be a Democrat," he said. Like most people in the state, Williams was born and raised a Democrat. When he was younger, he pranked his parents by telling them he registered as a Republican. His mother was concerned and his father was furious before they were let in on the joke. Now, Williams notes, half the people in his office couldn't vote for him in the primary because they weren't registered Democrats.

Asked whether he'd consider switching his party registration, Williams was unequivocal. "No, no, no," he said. "And if that's not clear: Hell no."

Williams argues that labels don't matter in the state. Progress on jobs and the economy does. Changing political affiliation would be a blatant political move, he says, and voters would see through it.

Manchin holds the same ethos. "Change would be self-service," he said. "I would question if I would vote for myself if I did that, because it would mean I was more concerned about getting re-elected."

All the talk of party switching and how Manchin will vote now that his party is on the ropes in the state is starting to frustrate the senator. “I don’t give a s--t. You understand? I just don’t give a s--t,” he told the Charleston Gazette Mail. “Don’t care if I get elected, don’t care if I get defeated, how about that."

Democrats in the state interpreted the quotes as Manchin throwing down the gauntlet for next year. But Republicans are eager to call his bluff.

Republicans Smell Opportunity

West Virginia Attorney General Patrick Morrisey and GOP Rep. Evan Jenkins have already lined up to take on Manchin, and more Republicans are expected to enter the primary. While Democrats argue that Gov. Justice's party change was more a reflection of his friendship with Trump and his own past as a Republican, Manchin's challengers insist it is reflective of a larger trend.

"It's the latest of literally tens of thousands over a number of years who have simply looked at the Democratic platform advanced by the likes of Barack Obama and Nancy Pelosi and Chuck Schumer and Elizabeth Warren, and is simply wrong for West Virginia," Jenkins told RCP.

Jenkins himself switched parties before running for Congress in 2014, defeating longtime Rep. Nick Rahall in the 3rd Congressional District. Jenkins said the party of Obama no longer represented his values.

That is a sentiment in line with a majority of West Virginians, who generally blame the Obama administration, particularly its environmental regulations, for their economic woes. "It wasn't just dislike; it was deep-seated hatred of the Obama administration," Manchin said, noting that he and the former president weren't able to see eye to eye. Obama was so unpopular in West Virginia that a prison inmate won more than 40 percent of the vote in the 2012 Democratic primary. Manchin withheld his endorsement of Obama in the general election.

Manchin laments that the national party brand in West Virginia has come to connote political correctness and government overreach and conflicts with the state motto. "Montani Semper Liberi," he says. "Mountaineers are always free."

But Manchin supported Hillary Clinton last year and appeared with her in the state even after she made an irreversible gaffe about putting coal miners out of business. Her statement had been in the context of creating additional energy options, but it cemented her status on the opposing side of West Virginia culture. Clinton called Manchin to apologize for the remarks, and he advised her not to return, given the political climate. But she made a commitment to Manchin that if elected, she would work to secure infrastructure projects, including expanded broadband, and funding for energy jobs in the state. Manchin agreed to campaign with her. He was close with the Clintons — former president Bill Clinton won the state twice — and figured she would win the general election and help the state.

Manchin's opponents will hang the endorsement around his neck. And the senator knows it, but feels voters will understand his intention to honor a commitment and will reward an honest broker. "You think I didn’t know the politically right thing?" He said.

Republicans also plan to associate Manchin with the national Democratic Party to portray him as out of touch with the state and standing in the way of the Trump agenda. They point to his leading a bipartisan effort on background checks for gun buyers in the wake of the 2012 Sandy Hook shootings, as well as his opposition to repealing Obamacare. "If Evan Jenkins was a United States senator, we would have been able to pass an important step in repeal and replacement of Obamacare," Jenkins said. "This came down to one vote. Joe Manchin voted no."

"We're Still Here"

Conrad Lucas, the state party chair, predicted the senator would share the same fate as Louisiana Democrat Mary Landrieu, who lost re-election in 2014 despite her roots in her state. "The strength of Democratic Party in West Virginia will only be read about in history books moving forward," Lucas told RCP.

Democrats in West Virginia acknowledge the uphill climb for someone like Manchin, but argue that the polarized political climate might lend itself to someone like him. "People know and trust the Manchin name. Outside money that’s coming in for someone not as well-known would have difficulty trying to shed that moniker of a Harry Reid, Pelosi, Sanders liberal," said Mayor Williams. Manchin "doesn't have a 'D' or an 'R' after his name -- he has a 'P,' which is pragmatic."

And while Manchin claims not to care about getting re-elected, he is embarking on a little crusade of his own -- for West Virginia Democrats.

"American people need to see -- especially people raised like I was – conservative, responsible, Democrats ... We're still here," the senator said.

Alexis Simendinger contributed to this report.