Roger Stone, a staunch ally of US President Donald Trump, has been sentenced to 40 months in federal prison.

It follows an extraordinary move by attorney general William Barr to back off his Justice Department’s original sentencing recommendation.

US District Court Judge Amy Berman Jackson said Stone’s crimes demanded a significant time behind bars but said the seven to nine years originally recommended by the Justice Department were excessive.

Stone’s lawyers had asked for a sentence of probation, citing his age of 67 years, his health and his lack of criminal history.

Roger Stone in 2019
Roger Stone in 2019 (Cliff Owen/AP)

He was convicted in November on all seven counts of an indictment that accused him of lying to Congress, tampering with a witness and obstructing the House investigation into whether the Trump campaign co-ordinated with Russia to tip the 2016 election.

The sentence came amid Mr Trump’s unrelenting defence of his longtime confidant that has led to a mini-revolt inside the Justice Department and allegations the president has interfered in the case.

Mr Trump took to Twitter to denounce as a “miscarriage of justice” the initial recommendation by Justice Department prosecutors that Stone receive at least seven years in prison.

Mr Barr then backed off that recommendation, prompting four prosecutors to quit Stone’s case.

Judge Jackson angrily denied that Stone was being punished for his politics or his allies.

“He was not prosecuted, as some have claimed, for standing up for the president. He was prosecuted for covering up for the president,” she said.

Stone was the sixth Trump aide or adviser to be convicted of charges brought as part of special counsel Robert Mueller’s Russia investigation.