Stay Updated on Developing Stories

Republican candidate in Montana is embracing Trump. But that wasn't always the case.

(CNN) Matt Rosendale, the Republican looking to unseat Democratic Montana Sen. Jon Tester in November, is running as an unflinching supporter of President Donald Trump, welcoming the President's visit to Great Falls on Thursday.

But Rosendale, the state auditor, was not always as enamored with the businessman-turned-politician as he is today. During one of the most heated periods of the 2016 Republican presidential primary, Rosendale backed Sen. Ted Cruz, signing up as a member of the campaign's "Montana Cruz Leadership Team" and showing his support for the Texas Republican multiple times on Twitter.

Two days before Rosendale's name was included on the list, Cruz told conservative radio host Mark Levin that Trump is "a New York liberal who is pretending to be a conservative to try to fool Republican primary voters."

The two were also fighting over a North Carolina law that would allow transgender Americans to use public bathrooms for the gender they identify as. Trump had criticized the law, to which Cruz said the Republican was "explicitly agreeing with Barack Obama and Hillary Clinton. They have the same views on religious liberty."

The support for Cruz belies Rosendale's attempt to tie himself to Trump, but seemingly did not -- because of Trump's visit -- run afoul of a loyalty test the White House is running when deciding endorsements in the midterms.

A spokesman for the Rosendale campaign did not respond to repeated calls from CNN for this story.

In a press release that is still available on Cruz's campaign site via a web archive, Rosendale is listed among the 19 members of the Texas Republicans' Montana leadership team.

"Republicans across America continue to unite behind Ted Cruz and his message of freedom and fiscal stability," said Montana Rep. Daniel Zolnikov said of the group at the time.

The Republican Senate candidate is now fully on board with Trump.

The President's oldest son, Donald Trump Jr., campaigned with Rosendale in June, who has applauded much of what Trump has done in office.

"Thank God we elected @realDonaldTrump," Rosendale tweeted when Supreme Court Justice Anthony Kennedy announced his retirement in June. "He now has a chance to nominate ANOTHER constitutional conservative to the Supreme Court!!!"

He has also cast the race as one between Trump and those who oppose him.

"The choice in the U.S. Senate race could not be clearer because I'll stand with @realDonaldTrump and back a nominee who will preserve our right to keep and bear arms, the right to life, and the right to protect our country -- and @JonTester won't," he wrote.

Tester, like other Democratic incumbents running for reelection in a red state, has pledged to work with Trump when needed. His first ad even touted the number of bills he has had signed into law by the President.

Chris Meagher, Tester's spokesman, said the campaign was "glad to hear President Trump is finally coming to Montana, after Jon has invited the Administration several times to Montana to discuss topics important to Montanans."

Meagher added that they assume the event will "turn out to be a partisan attack, rather than a real opportunity to discuss real issues facing Montanans - like better infrastructure, schools, holding the VA accountable, or the Farm Bill."

Outbrain