(CNN) President Donald Trump said Wednesday night in North Dakota that he is "honored" that Supreme Court Justice Anthony Kennedy decided to retire during his presidency.
"He felt confident in me to make the right choice and carry on his great legacy, that's why he did it," Trump said at a campaign rally in Fargo.
Trump also said he's looking to replace Kennedy with someone who will spend four decades on the Supreme Court.
"We have to pick a great one. We have to pick one that's going to be there for 40 years, 45 years. We need intellect. We need so many things," Trump said.
Kennedy announced his retirement Wednesday, allowing Trump -- who last year appointed Justice Neil Gorsuch -- to fill a second seat on the Supreme Court.
Trump, campaigning for Republican Rep. Kevin Cramer, who is challenging Democratic Sen. Heidi Heitkamp, said the Supreme Court "makes the issue of Senate control one of the vital issues of our time."
"Democrats want judges who will rewrite the Constitution any way they can do it, and take away your Second Amendment, erase your borders, throw open your jailhouse doors and destroy your freedoms," Trump said. "We must elect more Republicans -- we have to do that."
The rally came as Trump takes a victory lap. In addition to the announcement of Kennedy's retirement, two candidates he had endorsed, South Carolina Gov. Henry McMaster and Rep. Dan Donovan, of New York, prevailed in primaries Tuesday.
Trump was directly involved in recruiting a reticent Cramer into what Republicans see as one of their best opportunities to pick off a Democratic-held Senate seat.
However, he has also at times praised Heitkamp -- including at a September 2017 event in North Dakota, where Trump called Heitkamp a "good woman" and invited her onstage.
"Everyone's saying: What's she doing up here? But I'll tell you what: good woman," Trump said then.
On Wednesday night, though, Trump backed Cramer and lambasted Heitkamp, calling her a "liberal Democrat" and saying she does the bidding of Senate Minority Leader Chuck Schumer and House Minority Leader Nancy Pelosi.
"You need a senator who doesn't just talk like they're from North Dakota, but votes like they're from North Dakota. That's what you need, and that's Kevin Cramer," Trump said.