(CNN) President Donald Trump assailed a vulnerable Democrat, attacked those in his own administration seeking to undermine his agenda and warned supporters that his own impeachment is at stake in November's midterm elections at a rally Thursday night in Montana.

Addressing a senior administration official's anonymous, critical op-ed in The New York Times, Trump claimed it had "backfired."

"Unelected, deep state operatives who defy the voters to push their own secret agendas are truly a threat to democracy itself," Trump said.

He called on the newspaper to reveal the author's name.

"For the sake of our national security, The New York Times should publish his name at once," Trump said. "I think their reporters should go and investigate who he is. That would actually be a good story."

In a typical line of attack as Trump campaigns for Republicans ahead of this year's midterms, Trump said Democrats are the party of "anger and hate." He blasted Democratic Sen. Jon Tester, who is up for re-election this year, for releasing allegations that derailed the nomination of Rear Adm. Ronny Jackson , Trump's onetime personal White House physician, who was considered for veterans affairs secretary.

Trump also lashed out at Democratic members of the Senate Judiciary Committee for their aggressive questioning this week of Supreme Court nominee Brett Kavanaugh . Trump said committee members were "attacking Judge Kavanaugh and looking like fools."

"And one of them will most likely be a candidate to run against your favorite-of-all-time president -- me," he said. It was not clear whether Trump was referring to New Jersey Sen. Cory Booker or California Sen. Kamala Harris, both possible presidential candidates.

Montana is one of five states that Trump won by double digits in 2016 where a Democratic senator is up for re-election this fall -- which the White House and Republican strategists hope will give the President outsized influence on their Senate races.

In his second visit to Montana to campaign for state auditor Matt Rosendale, who is running against Tester in November's midterm elections, Trump attacked Tester for making public the allegations against Jackson, who withdrew his nomination.

"What Tester did to Adm. Jackson should never, ever be allowed. Ronny Jackson is a great man. Ronny Jackson has led a great and beautiful life" and had "lies told about him," Trump said.

Trump also warned that Democrats, if they win a majority in November's midterm elections, could impeach him. And if they did so, he said, the county "is going to turn into a third world country, because if the opposite party becomes president, before it even starts, before you've even found out whether or not he or she is going to do a great job."

"So let's say a Democrat gets elected someday -- hopefully it's a long time. But let's say a Democrat gets elected, and let's say we have a Republican House -- we will impeach that Democrat. Right? And then a Republican," Trump said.

Voting for party control of Congress, Trump said, is "a very important thing."

And if Democrats do pursue Trump's impeachment, he told the crowd, "it's your fault because you didn't go out to vote."

Trump's rallies often veer far from the topic of the Senate race he's there to weigh in on. In his July visit, Trump mocked the #MeToo movement, called Massachusetts Democratic Sen. Elizabeth Warren "Pocahontas," claimed California Democratic Rep. Maxine Waters' I.Q. is in the "mid-60s" and ridiculed Arizona Republican Sen. John McCain, who died nearly two weeks ago, for opposing his Obamacare repeal effort.

On Thursday night, he compared himself to Abraham Lincoln, saying the Gettysburg address -- one of the most famous speeches in American history -- was panned at the time, and that he believes his own presidency will similarly be viewed in a more positive light historically.

"I have a feeling that's going to happen with us. In different ways, that's going to happen with us," Trump said.

Trump made his typical claims that Democrats will roll back Second Amendment rights and favor open borders. He attacked Tester for opposing legislation to ban sanctuary cities.

Montana has long voted Republican in presidential elections, but Trump proved even more popular than other recent Republican presidential nominees. He won the state in 2016 by 21 percentage points -- a larger margin than Mitt Romney's 14 points in 2012 and McCain's 2 points in 2008.

Tester has largely opposed Trump's agenda. Of the five Democrats up for re-election in deep-red states, Tester and Missouri's Claire McCaskill voted against Neil Gorsuch's Supreme Court confirmation in 2017, while the others -- Indiana's Joe Donnelly, North Dakota's Heidi Heitkamp and West Virginia's Joe Manchin -- backed Gorsuch.

In a fundraising email to supporters Thursday morning, Tester highlighted Trump's visit to the state.

"Earlier this year, Trump said I'd 'have a big price to pay' this November -- which means he's ready to do whatever it takes to defeat me. It's why he's paying a second visit to my state," he wrote.