President Barack Obama has commuted the sentence of Chelsea Manning, the former army intelligence analyst who was convicted of providing classified military documents to WikiLeaks.

The 29-year-old whistleblower, who was sentenced to 35 years in prison in August 2013, will now be released in four months, on 17 May of this year, instead of 2024.

Prominent Republicans have reacted with outrage to the decision, with House Speaker Paul Ryan accusing Mr Obama of "leav[ing] in place a dangerous precedent".

But the Obama administration defended commuting Manning’s sentence by arguing that her case was fundamentally different from that of Edward Snowden, who fled to Russia after leaking documents exposing the National Security Agency's spying program.

“Chelsea Manning is somebody who went through the military criminal justice process, was exposed to due process, was found guilty, was sentenced for her crimes, and she acknowledged wrongdoing,” White House Press Secretary Josh Earnest told The New York Times.

“Mr Snowden fled into the arms of an adversary, and has sought refuge in a country that most recently made a concerted effort to undermine confidence in our democracy.”

Since her incarceration the former low-level soldier, who was known as Bradley Manning before she came out as transgender in 2013, attempted suicide twice last year and went on a hunger strike at the US Disciplinary Barracks in Fort Leavenworth, Kansas.

She continued her protest for less than a week until doctors allowed her to receive gender reassignment surgery. A military doctor has nonetheless refused to change her gender on her military records.

In the final days of his presidency, Mr Obama commuted a total of 209 sentences, pardoning 64 people at the same time. Over the course of his eight years in office, he has commuted the sentences of 1,385 people—the most issued by any president in US history. He’s also granted a total of 212 pardons.

“While the mercy the President has shown his 1,597 clemency recipients is remarkable, we must remember that clemency is an extraordinary remedy, granted only after the President has concluded that a particular individual has demonstrated a readiness to make use of his or her second chance,” White House Counsel Neil Eggleston wrote in a statement.

Protesters urge Obama to commute Chelsea Manning's sentence Show all 12 1 /12 Protesters urge Obama to commute Chelsea Manning's sentence Protesters urge Obama to commute Chelsea Manning's sentence torbakhopper/Flickr Protesters urge Obama to commute Chelsea Manning's sentence Garry Knight/Flickr Protesters urge Obama to commute Chelsea Manning's sentence People hold signs calling for the release of imprisoned wikileaks whistleblower Chelsea Manning while marching in a gay pride parade in San Francisco, California June 28, 2015. Manning has appealed to an Army court to overturn her court-martial conviction, a court filing released on Thursday said. Reuters Protesters urge Obama to commute Chelsea Manning's sentence Around twenty activists associated with the Chelsea Manning support group rally in front of the White House in Washington DC, Sunday May 11, 2014. Stephen Melkisethian/Flickr Protesters urge Obama to commute Chelsea Manning's sentence Daily Chalkupy/Flickr Protesters urge Obama to commute Chelsea Manning's sentence Around twenty activists associated with the Chelsea Manning support group rally in front of the White House in Washington DC, Sunday May 11, 2014. Protesters urge Obama to commute Chelsea Manning's sentence Twitter Protesters urge Obama to commute Chelsea Manning's sentence Abigail Edward holds up a sign advocating the release of WikiLeaks whistle blower Chelsea Manning along the Gay Pride parade route in San Francisco, California on Sunday, June, 26, 2016. Josh Edelson/AFP/Getty Images Protesters urge Obama to commute Chelsea Manning's sentence Demonstration for Chelsea Manning in London, England, United Kingdom. Chelsea Manning (born Bradley Edward Manning) is a United States Army soldier who was convicted by court-martial in July 2013 of violations of the Espionage Act and other offenses, after disclosing to WikiLeaks nearly three-quarters of a million classified or unclassified but sensitive military and diplomatic documents. Manning was sentenced in August 2013 to 35 years imprisonment, with the possibility of parole in the eighth year, and to be dishonorably discharged from the Army. Manning is a trans woman who, in a statement the day after sentencing, said she had felt female since childhood, wanted to be known as Chelsea, and desired to begin hormone replacement therapy. From early life and through much of her Army life, Manning was known as Bradley; she was diagnosed with gender identity disorder while in the Army. Mike Kemp/Getty Protesters urge Obama to commute Chelsea Manning's sentence Chelsea M Queer Friends/Twitter Protesters urge Obama to commute Chelsea Manning's sentence Instagram Protesters urge Obama to commute Chelsea Manning's sentence Jil Love Revolution/Instagram

“Only Congress can achieve the broader reforms needed to ensure over the long run that our criminal justice system operates more fairly and effectively in the service of public safety.

The American Civil Liberties Union, which is representing Manning, has pressured the current administration to commute her sentence for months. Her counsel has cited the dangers she faces as a transgender woman serving her sentence in an all-male detention center.

“I’m relieved and thankful that the president is doing the right thing and commuting Chelsea Manning’s sentence,” ACLU attorney Chase Strangio said in a statement.

“Since she was first taken into custody, Chelsea has been subjected to long stretches of solitary confinement—including for attempting suicide—and has been denied access to medically necessary health care. This move could quite literally save Chelsea’s life, and we are all better off knowing that Chelsea Manning will walk out of prison a free woman, dedicated to making the world a better place and fighting for justice for so many.”

Snowden, Assange and Manning statues unveiled in Berlin

The documents Manning provided to WikiLeaks revealed video footage of airstrikes from two US helicopters in 2007 that killed a dozen people in Baghdad, including two staffers with the Reuters news agency—22-year-old photographer Namir Noor-Eldeen and his 40-year-old assistant Saeed Chmagh.

Just last week, WikiLeaks founder Julian Assange agreed to be extradited to the United States if President Obama commuted Manning’s sentence. “If Obama grants Manning clemency Assange will agree to US extradition despite clear unconstitutionality of DoJ case,” WikiLeaks said on Twitter.

Now, the website addressed the statement, claiming that Assange is “confident of winning any fair trial in the states” and if Obama’s Justice Department prevents the “public interest defense” and provides a “fair jury.”

In another tweet, the website thanked everyone who supported Manning: "Thank you to everyone who campaigned for Chelsea Manning's clemency," WikiLeaks wrote on Twitter. "Your courage & determination made the impossible possible."

President-elect Donald Trump is yet to comment on Mr Obama's decision, but Republicans who criticised it included Mr Ryan, Arizona Senator John McCain, and Arkansas Senator Tom Cotton.

“This is just outrageous," the Speaker said. "Chelsea Manning’s treachery put American lives at risk and exposed some of our nation’s most sensitive secrets.

“President Obama now leaves in place a dangerous precedent that those who compromise our national security won’t be held accountable for their crimes,” Mr Ryan added.

Senator McCain argued that the commutation was a "grave mistake" that may "encourage further acts of espionage and undermine military discipline." Senator Cotton added that the Americans should treat Manning like a traitor instead of a martyr.