US President Barack Obama has commuted Chelsea Manning’s sentence for leaking documents to Wikileaks in 2010.
The 29-year-old transgender US Army private, born Bradley Manning, will be freed on 17 May instead of her scheduled 2045 release.
She was sentenced to 35 years in 2013 for her role in leaking diplomatic cables to the anti-secrecy group.
The leak was one of the largest breaches of classified material in US history.
The commutation reduces Manning’s sentence but is not a pardon, which some campaigners had called for.
More on Chelsea Manning
Manning’s uncle, Kevin Fox, referring to Chelsea as a man, told the BBC the family was “over the moon”.
“It’s sooner than we expected – we didn’t expect his case even to be looked at for another three or four years,” Mr Fox said.
Manning lived for four years as a teenager in Wales. Her Welsh family said in a statement that they were “overjoyed”, adding that there would “always be a welcome for her here in Wales”.
Manning twice attempted suicide last year at the male military prison where she is being held at Fort Leavenworth, Kansas.
She also went on a hunger strike last year, which she ended after the military agreed to provide her with gender transition treatment.
Mr Obama granted commutation of sentences to 209 individuals and pardons to 64 others, in one of his final acts as president.
What’s the reaction?
Manning’s lawyer, David Coombs, told the BBC the decision would be a great relief to his client.
“It really is a great act of mercy by President Obama,” said Mr Coombs.
Journalist Glenn Greenwald, who broke the story of Edward Snowden’s leaks, told the BBC: “I don’t think she (Manning) should have spent a single day in prison.”
He said she was “heroic and has inspired millions of people around the world”.
Writing on Twitter, Mr Snowden said: “Let it be said here in earnest, with good heart: Thanks, Obama.”
But Republican Senator John McCain said the decision was “a grave mistake that I fear will encourage further acts of espionage”.
And House Speaker Paul Ryan, also a Republican, called it “outrageous”.
What was in the leaked cables?
The US Army charged Manning with 22 counts relating to the unauthorised possession and distribution of more than 700,000 secret diplomatic and military documents and video.
Included in those files was video footage of an Apache helicopter killing 12 civilians in Baghdad in 2007.
The disclosures were considered an embarrassment to the US, prompting the Obama administration to crack down on government leaks.
At a sentencing hearing, Manning apologised for “hurting the US” and said she had thought she could “change the world for the better”.