A US judge has ordered the immediate release of former army intelligence analyst Chelsea Manning from prison.
Manning had been remanded for refusing to testify in an inquiry into Wikileaks and had been in detention in Virginia since last May.
She was scheduled to appear in court on Friday, but the judge ruled that it was no longer necessary for her to testify.
Manning was found guilty in 2013 of charges including espionage for leaking secret military files to Wikileaks.
She accrued more than $US250,000 in fines for refusing to co-operate with the inquiry. Her legal team had asked for these to be vacated, but the judge said they must be paid in full.
Manning, 32, had refused to answer further questions about Wikileaks from investigators because she said she had already given her testimony during the 2013 trial.
Her release order on Thursday came shortly after her legal team said she had tried to take her own life and was recovering in hospital.
Police confirmed there was "an incident" involving Manning at the detention centre in Virginia on Wednesday afternoon. "It was handled appropriately by our professional staff and [she] is safe," a police statement said.
Manning leaked hundreds of thousands of secret US military files relating to the Afghan war to Wikileaks in 2010. She was sentenced to 35 years in prison, but former President Barack Obama commuted the rest of her sentence in 2017.
US prosecutors have been investigating Wikileaks for several years.
They are currently seeking the extradition of its co-founder Julian Assange from the UK over his alleged role in the 2010 release of classified military and diplomatic material.
Australian-born Assange faces a charge of conspiracy to commit computer intrusion in the US.