The Obama administration struck back at Russia on Thursday, imposing sanctions against its intelligence apparatus and expelling 35 diplomats in retaliation for the alleged orchestration of hacking attacks designed to interfere in the presidential election.

The sweeping actions, outlined by the White House three weeks before the new administration takes office, include:

Shutting down two compounds, one in Maryland and one in New York, "used by Russian personnel for intelligence-related purposes."

Sanctions against the GRU, the Russian military intelligence service, and the FSB, the spy agency that succeeded the KGB, and four high-ranking officers of the GRU.

Sanctions against two suspected hackers, both wanted by the FBI in earlier cybercrime cases, and three companies that allegedly provided support to the GRU's cyber operations.

Releasing technical information about Russian cyber activity, "to help network defenders in the United States and abroad identify, detect, and disrupt Russia’s global campaign of malicious cyber activities."

"All Americans should be alarmed by Russia’s actions," President Obama said in a statement, blaming the "highest levels" of the Russian government.

Obama's statement said the U.S. had declared 35 Russian "intelligence operatives" persona non grata. The State Department said the 35 are diplomats "who were acting in a manner inconsistent with their diplomatic or consular status" and also accused Russia of harassing U.S. diplomats overseas with arbitrary police stops, physical assaults and the release of personal details putting them at risk.

"The diplomatic sanctions today were in response to the diplomatic harassment from Russia we've seen over the past two years," White House deputy press secretary Eric Schultz said.

As of noon on Friday, the U.S. also will bar Russian access to two Moscow-owned "recreational compounds," the White House said. A 45-acre property at Pioneer Point in Maryland was purchased by the Soviet government in 1972, and the 14-acre property on New York's Long Island was purchased by the Soviet government in 1954.

Russia has repeatedly denied involvement in the attacks on Democratic Party organizations and figures. After the announcement from Washington, President Vladimir Putin's press secretary said Moscow would hit back but was in no rush.

"As we said before, we consider such a decision and such sanctions groundless and illegitimate from the point of view of international law," Putin spokesman Dmitry Peskov said, according to the Interfax news agency.

President Obama expels 35 diplomats in Cold War deja vu. As everybody, incl people, will be glad to see the last of this hapless Adm. pic.twitter.com/mleqA16H8D — Russian Embassy, UK (@RussianEmbassy) December 29, 2016

The Russian embassy in the U.K. tweeted a picture of a duckling with the word "Lame" emblazoned over it, and Konstantin Kosachev, a Russian political leader, also noted that Obama will not be president much longer. "This not just an agony of the 'lame ducks,' but of the 'political corpses,'" he said, according to Interfax.

As NBC News first reported two weeks ago, U.S. intelligence officials believe Putin was personally involved in the alleged hacking campaign, and the CIA concluded that one of the goals was to help elect Donald Trump by leaking emails that were embarrassing to Democrats.

Trump has expressed doubt as to whether Russia tried to meddle in the election. Asked on Wednesday, before the sanctions were imposed, about possible sanctions, he said, "I think we ought to get on with our lives."

Trump echoed that sentiment Thursday evening, but said he wants to meet with U.S. intelligence officials.

"It's time for our country to move on to bigger and better things," Trump said in a statement on the sanctions. "Nevertheless, in the interest of our country and its great people, I will meet with leaders of the intelligence community next week in order to be updated on the facts of this situation."

Trump was first briefed on suspected Russian involvement starting in mid-August and his team has since received extensive intelligence on the issue, a senior U.S. intelligence official said. The Trump team was briefed on Thursday's announced actions against Russia beforehand, the official said.

Trump could reverse the actions, but he would have to buck Republican members of Congress who support the sanctions and have called for even stiffer measures.

Vladimir Putin said today about Hillary and Dems: "In my opinion, it is humiliating. One must be able to lose with dignity." So true! — Donald J. Trump (@realDonaldTrump) December 24, 2016

"The retaliatory measures announced by the Obama Administration today are long overdue," U.S. Senators John McCain, R-Ariz., and Lindsey Graham, R-S.C., said in a joint statement. "But ultimately, they are a small price for Russia to pay for its brazen attack on American democracy. We intend to lead the effort in the new Congress to impose stronger sanctions on Russia."

The White House vowed that U.S. retaliation will go beyond the steps announced Thursday.

"We will continue to take a variety of actions at a time and place of our choosing, some of which will not be publicized," Obama said in his statement.

The economic sanctions against the Russian agencies, companies and individuals were contained in an executive order signed by Obama.

An FBI wanted poster for an alleged hacker who is now a target of U.S. sanctions. FBI

The sanctioned individuals include two alleged hackers, Evgeniy Mikhaylovich Bogachev, aka "Lucky12345," and Aleksey Belan, aka "Mrmagister."

Bogachev was indicted in a 2014 case in Pennsylvania in connection with a "phishing" scheme to steal money through electronic fund transfers from victims’ bank accounts, and he was charged in a 2014 Nebraska case with trying to defraud 12 banks. Belan allegedly broke into the computer networks for three major U.S. e-commerce companies in 2012 and 2013.

The named Russians who hold positions in the GRU are: Chief Igor Korobov, First Deputy Chief Vladimir Alexseyev, First Deputy Chief Igor Kostyukov, and Deputy Chief Sergey Gizunov.