The United States struck back Thursday at Russia for hacking the U.S. presidential campaign with a sweeping set of punishments targeting Russia's spy agencies and diplomats.

The U.S. said Russia must bear costs for its actions, but Moscow called the Obama administration "losers" and threatened retaliation.

A month after an election that the U.S. says Russia tried to sway for Donald Trump, President Barack Obama sanctioned the GRU and the FSB, the leading Russian intelligence agencies the U.S. said were involved.

All Americans should be alarmed by Russia's actions. - U.S. President Barack Obama

Obama also kicked out 35 Russian diplomats and shut down a pair of Russian compounds in the U.S.

"All Americans should be alarmed by Russia's actions," Obama said in a statement released while he was vacationing in Hawaii. He added: "Such activities have consequences."

In a bid to expose Moscow's cyber aggression, U.S. intelligence agencies released a detailed report about Russia's hacking infrastructure. And Obama said more action was coming.

Obama said the hacking "could only have been directed by the highest levels of the Russian government," a contention the U.S. has used to suggest Russian President Vladimir Putin was personally involved.

U.S. president-elect Donald Trump has dismissed as 'ridiculous' claims Russian hacked the Democratic Party in an effort to help him win the election. (Jonathan Ernst/Reuters)

The sanctions could easily be pulled back by Trump, who has dismissed the claims of Russian interference in the election as "ridiculous" and insisted that Obama and Democrats are merely attempting to delegitimize his election.

Trump said in a statement Thursday it was "time for our country to move on to bigger and better things." But he said he'll meet with U.S. intelligence officials next week "in order to be updated on the facts of this situation."

Russia vows retaliation

The Kremlin, which denounced the sanctions as unlawful and promised "adequate" retaliation, questioned whether Trump approved of the new sanctions. Moscow denies the hacking allegations.

The spokesman for Putin said the new sanctions were a sign of Obama's "unpredictable and, if I may say, aggressive foreign policy" and were aimed at undermining Trump.

"We think that such steps by a U.S. administration that has three weeks left to work are aimed at two things: to further harm Russian-American ties, which are at a low point as it is, as well as, obviously, to deal a blow to the foreign policy plans of the incoming administration of the president-elect," Dmitry Peskov told reporters in Moscow.

Russian embassies in other countries, including Canada, have responded with tweets mocking the U.S.

Final act of the Russian-American "reset": computer is crashed, new delivery due January 20th <a href="https://t.co/lrpLqXclPI">pic.twitter.com/lrpLqXclPI</a> —@RussianEmbassyC 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. <a href="https://t.co/mleqA16H8D">pic.twitter.com/mleqA16H8D</a> —@RussianEmbassy

Maria Zakharova, a Russian foreign ministry spokeswoman, took to Facebook to call the Obama administration "a

group of foreign policy losers, angry and ignorant."

72 hours to get out

Although the White House announced at the same time it was kicking out Russian officials and closing facilities, it said those were responses to other troubling Russian behaviour: harassment of U.S. diplomats by Russian personnel and police.

U.S. President Barack Obama talks with Russia's President Vladimir Putin as they gather for a family photo with fellow world leaders at the start of the 2015 G20 summit in Turkey. Russia says relations between the two countries are 'at a low point.' (Jonathan Ernst/Reuters)

The 35 Russian diplomats being kicked out are intelligence operatives, Obama said. The State Department said they were being declared "persona non grata," and they were given 72 hours to leave the country.

The two compounds being closed down are recreational facilities owned by Russia's government, one in Maryland and one in New York, the U.S. said. The White House said Russia had been notified that Russia would be denied access to the sites starting noon on Friday.