(Peter Stevenson/The Washington Post)

A month before the election, President Trump stood before a cheering crowd at a rally in northeast Pennsylvania and declared: “I love WikiLeaks!”

Back then, Trump loved anything that made his rival Hillary Clinton look bad — even if the information had been hacked, stolen or leaked. Trump repeatedly celebrated and shared information released by WikiLeaks, calling the anti-secrecy organization “a treasure trove.” During a news conference last summer, Trump even urged Russia — which U.S. intelligence agencies believe has links to WikiLeaks — to look for tens of thousands of emails from Clinton’s private server that were not handed over to the Justice Department.

But now that he is in the White House, Trump is having to confront the threat of hacking, along with leaks from within his own administration — and, suddenly, he is not a fan. Trump and his aides have angrily railed against leakers, threatening to find and prosecute them and urging congressional allies to investigate, while being uncharacteristically quiet when it comes to WikiLeaks.

The latest sign of how the tables have turned came Tuesday when WikiLeaks announced that it had obtained a vast portion of the CIA’s closely guarded cyberweapons and began posting files online. The breach could cause massive fallout among U.S. allies and poses a serious challenge for Trump, who has been feuding with the intelligence community over probes into alleged ties between his campaign and Russia.

President Trump walks into the East Room of the White House for a meeting with House Republicans on Tuesday. (Jabin Botsford/The Washington Post)

White House press secretary Sean Spicer declined to comment on the latest WikiLeaks dump during a briefing with reporters Tuesday, saying it “has not been fully evaluated.” But moments later, Spicer did decry leaks generally, saying they “are threatening our national security.”

“You’re seeing the leaks happen over and over again that come out throughout the administration, throughout government and undermine national security,” he said.

The president has said that the emails released by WikiLeaks during the campaign do not compare to the information now being leaked, some of which he says is classified.

“In one case, you’re talking about highly classified information. In the other case, you’re talking about John Podesta saying bad things about the boss,” Trump said at a news conference last month, referring to Clinton’s presidential campaign chairman whose private email account was hacked.

While the files being posted by WikiLeaks on Tuesday have yet to be authenticated, Sen. John McCain (R-Ariz.) said that if the group “can hack the CIA, they can hack anybody.” McCain also mocked Trump for belittling earlier hacks by suggesting that they were being carried out by “somebody in the basement of his mother’s house smoking a cigarette in his underwear” rather than a foreign government. McCain said the White House needs to focus on the issue quickly.

“I’d like to see a greater emphasis, to tell you the truth,” McCain said. “I really would. I’d like to see a greater emphasis.”

For months, a variety of people have warned Trump that hacking is something that should always be condemned and never encouraged — even in a joking tone.

(Dalton Bennett,Greg Miller/The Washington Post)

In July, WikiLeaks published thousands of emails from the Democratic National Committee. Days later, Trump scoffed at accusations that the Russians could have been involved with the hack, saying that it was “probably China, or it could be somebody sitting in his bed.” He added that he hoped Russia had all of Clinton’s emails, even the “beauties” that were deleted or were not turned over to the Justice Department.

“I will tell you this, ‘Russia, if you’re listening, I hope you’re able to find the 30,000 emails that are missing,’” Trump said, referring to messages that Clinton did not hand over because she and her team categorized them as personal. “I think you will probably be rewarded mightily by our press. Let’s see if that happens.”

Republicans rushed to denounce the comment, and Trump’s running mate Mike Pence quickly issued a statement that read: “If it is Russia and they are interfering in our elections, I can assure you both parties and the United States government will ensure there are serious consequences.”

Months later, in October, Podesta’s email account was hacked, and his emails were released by WikiLeaks. At the time, Podesta said the FBI was investigating the “criminal hack” as part of a wider inquiry into potential Russian cyberattacks — and he suggested Trump might have known about the hack ahead of time.

Trump and his associates have denied having anything to do with the hacks, although at a Jan. 11 news conference, Trump conceded that Russia was probably behind the hacks. He added that the Russians might have tried to hack the Republican National Committee but were unable to because it had “a very, very strong hacking defense.”

“The Democratic National Committee was totally open to be hacked. They did a very poor job. They could have had hacking defense, which we had,” Trump said. “They tried to hack the Republican National Committee, and they were unable to break through. We have to do that for our country. It’s very important.”

Jennifer Palmieri, the communications director for Clinton’s 2016 campaign, said watching Trump decry leaks within his own administration after praising WikiLeaks during the campaign has been an exercise in the absurd.

Now, she said, Trump may be forced to confront the consequences of normalizing a culture of leaks and hacks.

“He was playing with fire all during the campaign, and he’s started to get burned,” she said. “When you bring leaks and investigations into the political realm, you’re playing with fire.”

Robby Mook, Clinton’s former campaign manager, said Tuesday that he hopes Trump finally realizes that the hacking that happened during the election is “an anti-American problem,” not a partisan one, and needs to be investigated so it does not become a regular part of the political process.

“The problem at its core is that a country that our own Joint Chiefs of Staff said was our greatest enemy and greatest threat to our security stole information from one of our national political parties and used it against one of the candidates,” Mook said, referring to Russia. “Do I believe that this is going to come back to haunt the Republicans? Absolutely, I do.”

Karoun Demirjian contributed to this report.