CHARLESTON, W.Va. ― Gov. Jim Justice announced he’s joining the Republican Party during a rally with President Donald Trump on Thursday evening. Justice was elected as a Democrat in 2016, defeating Republican Bill Cole.

“Today I’ll tell you, as West Virginians, I can’t help you anymore being a Democrat governor,” he said during his remarks at Trump’s rally. “So tomorrow, I will be changing my registration to Republican.”

“The democrats walked away from me,” he said.

Justice described Trump as a close friend, and said he had gone to the Oval Office twice in the last several weeks to discuss coal and manufacturing with the president.

“I want to thank your great governor, having Big Jim as a Republican is such an honor,” Trump said after Justice’s remarks.

Trump had teased the announcement earlier in the day, telling reporters he would be making “a very big announcement” Thursday evening in Huntington, West Virginia.

The switch came as a shock to staffers in Justice’s office, two sources told HuffPost. “No one in the administration knew,” one person in Justice’s office said. “It took everyone by complete surprise.”

There are many parallels between Justice and Trump. Both are businessmen who own and operate hotels. Both have had major financial troubles. Both had little experience in politics before their 2016 campaigns.

The two have had similar messaging on energy, promising to bring back jobs in a state that considers the coal industry part of its identity. Both have questioned whether humans contribute to climate change.

Jason Binn via Getty Images

Justice’s chief of staff, Nick Casey, is a former chairman of the West Virginia Democratic Party. It’s unclear if Casey was aware of Justice’s plans before the change was disclosed.

Jordan Burgess, executive director of the West Virginia Republican Party, said Justice’s move marks a significant shift in a formerly blue state.

“West Virginia has come a long way in our comeback story of rejecting nearly a century of liberal Democrat control,” Burgess said in a statement. “Tonight marks yet another step in our movement.”

Burgess acknowledged the state GOP’s past criticism of Justice, including a tweet hours before the news of the party switch.

Low-Energy @WVGovernor Refuses To Stop Millions Of $$ In Contracts To Companies Who Cheated WV Taxpayers. Sad!https://t.co/Nf1QvGaWl3 — WVGOP (@WVGOP) August 3, 2017

“Jim Justice’s past differences with our Party and our Party’s platform came while he was a Democrat,” Burgess said. “We look forward to a new beginning as the Governor now embraces the Republican Party. We hold members of our own Party to an even higher standard.”

Democrats, meanwhile, criticized the switch.

“Jim Justice deceived the voters of West Virginia when he ran as a Democrat 8 months ago,” Democratic Governors Association executive director Elisabeth Pearson said in a statement. “West Virginians have learned that they simply can’t trust Jim Justice. He will always put his financial interests above the needs of West Virginians.”

“Jim Justice said he became a Democrat because Democrats care about people,” said West Virginia Democratic Party chair Belinda Biafore. “I think we can all guess just who he cares about by his decision today and it’s not the people of West Virginia.”

Thursday marks the second time in as many weeks Trump has visited West Virginia, which he won easily in the 2016 election. He made headlines last week with a fiery political speech at the National Scout Jamboree in Glen Jean.

This article has been updated throughout.