WASHINGTON -- President Donald Trump has commuted the sentence of his longtime political confidant Roger Stone, intervening in extraordinary fashion in a criminal case that was central to the Russia investigation and that concerned the president's own conduct.

The move came Friday, just days before Stone was to begin serving a 40-month prison sentence for lying to Congress, witness tampering and obstructing the House investigation into whether Trump's campaign colluded with Russia to win the 2016 election.

The action, which Trump had foreshadowed in recent days, underscores the president's lingering rage over special counsel Robert Mueller's investigation and is part of a continuing effort by the president and his administration to rewrite the narrative of a probe that has shadowed the White House from the outset. Democrats, already alarmed by the Justice Department's earlier dismissal of the case against Trump's first national security adviser, Michael Flynn, denounced the president as further undermining the rule of law.

Stone, 67, had been set to report to prison on Tuesday after a federal appeals court rejected his bid to postpone his surrender date. But he told The Associated Press that Trump called him Friday evening to tell him he was off the hook.

"The president told me that he had decided, in an act of clemency, to issue a full commutation of my sentence, and he urged me to vigorously pursue my appeal and my vindication," Stone said by phone from Fort Lauderdale, Florida, where he was celebrating with friends. He said he had to change rooms because there were "too many people opening bottles of Champagne here."

Although a commutation does not nullify Stone's felony convictions, it protects him from serving prison time as a result.

The move is another extraordinary intervention by Trump in the nation's justice system and underscores anew his willingness to flout the norms and standards that have governed presidential conduct for decades. As Trump stares down a coronavirus pandemic that has worsened his chances for reelection, he has been more willing than ever to test the limits of his power.

Democrats denounced Trump's action. House Speaker Nancy Pelosi on Saturday called it "an act of staggering corruption," saying legislation is needed to prevent a president from pardoning or commuting the sentence of someone who acted to shield that president from prosecution.

House Intelligence Committee Chair Adam Schiff called it "offensive to the rule of law and principles of justice. Democratic National Committee Chair Tom Perez asked, "Is there any power Trump won't abuse?"

Sen. Mitt Romney, a Utah Republican, also condemned the move. "Unprecedented, historic corruption: an American president commutes the sentence of a person convicted by a jury of lying to shield that very president," he tweeted Saturday.

White House press secretary Kayleigh McEnany said in a statement that Stone was a "victim of the Russia Hoax that the Left and its allies in the media perpetuated for years in an attempt to undermine the Trump presidency."

Stone had been open about his desire for a pardon or commutation, appealing for the president's help in a monthslong television and social media campaign and seeking to postpone his surrender date by months after getting a brief extension from the judge, in part by citing the coronavirus.

Trump, who had made clear in recent days that he was inching closer to acting, had repeatedly publicly inserted himself into Stone's case, including just before Stone's sentencing.

That earned a public rebuke from his own attorney general, William Barr, who said the president's comments were "making it impossible" for him to do his job. Barr was so incensed that he told people he was considering resigning over the matter.

"With this commutation, Trump makes clear that there are two systems of justice in America: one for his criminal friends, and one for everyone else," Schiff said. "Donald Trump, Bill Barr, and all those who enable them pose the gravest of threats to the rule of law."

Stone, a larger-than-life political character who embraced his reputation as a dirty trickster, was the sixth Trump aide or adviser to have been convicted of charges brought during Mueller's investigation.

A longtime Trump friend and informal adviser, Stone boasted during the campaign that he was in contact with WikiLeaks founder Julian Assange through a trusted intermediary and hinted at inside knowledge of WikiLeaks' plans to release more than 19,000 emails hacked from the servers of the Democratic National Committee.

But Stone denied any wrongdoing and consistently criticized the case against him as politically motivated. He did not take the stand during his trial, did not speak at his sentencing. His lawyers did not call any witnesses in his defence.

Prosecutors had originally recommended Stone serve seven to nine years in prison. But in a highly unusual move, Barr reversed that decision after a Trump tweet and recommended a more lenient punishment, prompting a mini-revolt inside the Justice Department, with the entire prosecution team resigning from the case.

Department officials have vehemently denied Barr was responding to Trump's criticism and have insisted there was no contact with the White House over the decision. Barr has also pointed out that the judge, in imposing a 40-month sentence, had agreed with him that the original sentencing recommendation was excessive.

Barr has said the prosecution was justified, and the Justice Department did not support Stone's more recent effort to put off his surrender date. Though the Justice Department raised concerns about the handling of Flynn's case, including what it said were irregularities about his FBI interview, prosecutors did not point to any similar issues or problems with the Stone prosecution.

Even so, the commutation will almost certainly contribute to a portrait of a president determined to erase the impact of the Russia investigation and to intervene on behalf of allies.

The commutation was the latest example of Trump using his unlimited clemency power to pardon powerful men he believes have been mistreated by the justice system.

Trump went on a clemency spree in February, commuting the 14-year prison sentence of former Illinois Gov. Rod Blagojevich, a Democrat, and pardoning former New York City police commissioner Bernie Kerik, financier Michael Milken and several others.

Trump has also offered clemency to other political allies, including Joe Arpaio, an Arizona sheriff who was awaiting sentencing at the time, conservative commentator Dinesh D'Souza, who had been convicted on campaign finance violations, and Conrad Black, a newspaper publisher convicted of fraud who had written a flattering book about the president.

Trump, however, has spent much more time trumpeting his decision to commute the sentence of Alice Marie Johnson, who was serving life in prison for nonviolent drug offences and who came to Trump's attention after reality star Kim Kardashian West took up her cause. Her story was featured in a Trump campaign Super Bowl ad.

Stone told the AP he expressed his gratitude to Trump in the phone call.

"You know, he has a great sense of fairness," Stone said. "We've been friends for many, many years, and he understands that I was targeted strictly for political reasons."