Image copyright Getty Images Image caption The decision marks a low point in the relationship between Presidents Putin and Obama

The US has expelled 35 Russian diplomats as punishment for alleged interference into last month's presidential elections, giving them 72 hours to leave the country.

It will also close two compounds used for Russian intelligence-gathering.

President Barack Obama had vowed action against Russia amid US accusations it directed hacks against the Democratic Party and Hillary Clinton's campaign.

Russia has denied any involvement and called the decision "ungrounded".

The US state department declared the 35 Russian diplomats from the Washington DC embassy and the consulate in San Francisco "persona non grata", and gave them and their families 72 hours to leave the US.

The move follows calls from senior US senators to sanction Russian officials who are believed to have played a role in the hacking, which some lawmakers referred to as America's "political Pearl Harbor".

Republican senators John McCain and Lindsey Graham, who led the calls for sanctions, said they "intend to lead the effort in the new Congress to impose stronger sanctions on Russia".

A Kremlin spokesman told journalists in Moscow that President Vladimir Putin would consider retaliatory measures.

Dmitry Peskov said the actions were "a manifestation of unpredictable and aggressive foreign policy", and called them "ungrounded and not legal".

And the Russian embassy in the UK tweeted a visual gag calling the Obama presidency a lame duck.

Image copyright @RussianEmbassy

President-elect Donald Trump, who will take over from President Obama next month, has dismissed the hacking claims as "ridiculous" and said Americans should "get on with our lives" when asked about the possibility of sanctions before the announcement on Wednesday.

Sanctions have also been announced against nine entities and individuals including Russian intelligence agencies, the GRU and the FSB.

Russian intelligence compounds in New York and Maryland will be closed.

'Necessary and appropriate'

In a statement, President Obama called the moves a "necessary and appropriate response to efforts to harm US interests" and said "all Americans should be alarmed by Russia's actions".

Mr Obama also announced the US would declassify technical information related to 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".

Speaker of the House Paul Ryan, the top Republican in Congress, said in a statement that despite the measures being overdue "it is an appropriate way to end eight years of failed policy with Russia".

Democratic Senator Ben Cardin, who is from Maryland, called for Congress to take action separately from the White House, and plans to introduce legislation to establish a committee "to further examine the attack and Russian's efforts to interfere in our election".

'A decade-long campaign'

In a joint statement by the Department of Homeland Security, the Office of the Director of National Security, and the FBI, US officials appeal to companies to "look back within their network traffic" and report any signs of "malicious cyber activity" to law enforcement.

The Russian hacking, which the US intelligence agencies describe as a "decade-long campaign" included methods such as "spearphishing, campaigns targeting government organisations, critical infrastructure, think-tanks, universities, political organisations, and corporations; theft of information from these organisations; and the recent public release of some of this stolen information".

Emails stolen from Hillary Clinton's campaign manager and from the servers of the Democratic National Committee were released during the 2016 presidential election by Wikileaks.

Several US agencies, including the FBI and CIA have concluded that the hacked information was released to cause damage to Mrs Clinton and the Democrats in order to favour Mr Trump.