Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A federal judge ordered Thursday that former Army analyst Chelsea Manning immediately be released from the Virginia jail where she's been held in contempt for almost a year.

Manning, 32, was taken to a hospital Wednesday after she attempted suicide, her legal team said. She had been scheduled for a hearing Friday in Alexandria, Virginia, where she has been held since May after she refused to answer questions from a grand jury looking into the release of documents to WikiLeaks.

But U.S. District Judge Anthony Trenga said Thursday that the grand jury had completed its business and found that Manning's "appearance before the Grand Jury is no longer needed." He ordered the Justice Department to release her immediately but ordered her to pay the $256,000 in fines that had accrued as she fought the order to testify.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Download the NBC News app for breaking news

Manning was convicted at a court-martial of espionage and other charges in 2013 for leaking secret military files to WikiLeaks. She has refused to answer further questions about WikiLeaks, arguing that she already did so during her trial seven years ago.

She was ordered jailed in May 2019 after refusing to appear before the grand jury, even with a grant of immunity. She was told then that she would be jailed and fined each day until she agreed to appear or until the grand jury went out of existence. (Federal grand juries typically serve limited terms.)

Manning was sentenced to 35 years in prison, but she was released in 2017 after President Barack Obama commuted her sentence.

Manning said she refused to testify before the grand jury because "I don't believe in the grand jury process."

"I don't believe in the secrecy of this," she said outside the courthouse before she was jailed.

Her lawyers asked that the fine be set aside, but the judge denied the request Thursday, declaring that it had been "necessary to the coercive purpose" of the civil contempt order that put her in jail in the first place.

If you or someone you know is in crisis, call the National Suicide Prevention Lifeline at 800-273-8255, text HOME to 741741 or visit SpeakingOfSuicide.com/resources for additional resources.