Former Army intelligence analyst Chelsea Manning will be held in jail until she testifies before a grand jury or that grand jury is no longer operating, a federal judge in Alexandria ruled Friday.

Most of the hearing at which prosecutors argued for Manning to be held in contempt was sealed, but the court was open to the public for argument over whether she should be put in jail and Judge Claude M. Hilton’s ruling.

“I’ve found you in contempt,” Hilton said. He ordered her to custody immediately, “either until you purge yourself or the end of the life of the grand jury.”

The investigation Manning was called to testify in remains secret, but she said she was asked about WikiLeaks, the anti-secrecy website she shared classified documents with in 2010. Manning served seven years of a 35-year prison sentence for her leak before receiving a commutation from President Barack Obama.

Outside court before the hearing, Manning said she was prepared to go to jail.

“These secret proceedings tend to favor the government,” she said. “I’m always willing to explain things publicly.”

Manning held up a large stack of papers — the transcripts from her military trial, which she said would tell prosecutors everything they want to know.

“I’ve given voluminous testimony; I’ve given voluminous information,” she said.

In a 2013 pretrial hearing, prosecutors disclosed excerpts of chat logs taken from Manning’s personal laptop, including one in which Manning allegedly asked Assange for help in cracking a password. In another, Manning allegedly told Assange “i’m throwing everything i’ve got on” Guantanamo detainee reports “at you now,” to which Assange allegedly replied, “OK…great.”

In a long sworn statement at the end of the pretrial inquiry, Manning said “the decisions that I made to send documents and information” to WikiLeaks “were my own.” She was questioned by a military judge about the statement. But she never took the stand during the trial itself, so prosecutors never had the opportunity to question her.

Manning’s attorney, Moira Meltzer-Cohen, on Friday told the judge it would be “an act of tremendous cruelty” to send the transgender ex-private to jail given medical and safety concerns. Manning came out as transgender after her sentencing in 2013.

Outside court, Meltzer-Cohen praised Manning’s courage. When asked by a reporter about a possible appeal of the judge’s ruling, Meltzer-Cohen said that would be “quite likely.”

Prosecutor Tracy McCormick said in court that the jail has experience handling both transgender inmates and public figures.

“The government does not want to confine Ms. Manning,” McCormick said. “She could change her mind right now and decide to testify.”

Manning’s attorney did thank prosecutors for working in “good faith,” saying “they bent over backwards to accommodate” medical needs linked to Manning’s gender transition.

Hilton said any medical concerns Manning has should be addressed with the U.S. Marshals but that the court was available if she has problems.

WikiLeaks’s founder, Julian Assange, has been charged in a case that remains under seal but was inadvertently exposed by prosecutors late last year, though the details remain secret. He is under asylum at the Ecuadoran Embassy in London.