A federal judge ordered Chelsea Manning back to jail Thursday after she again refused to cooperate with a grand jury investigating a release of documents by WikiLeaks.

U.S. District Court Judge Anthony Trenga had Manning remanded and sentenced her to pay a fine of $500 per day if she doesn't comply in 30 days and $1,000 after 60 days pass.

U.S. marshals took Manning into custody for a term that could last as long as 18 months.

"I would rather starve to death than change my position in this regard," Manning told the court. “Confinement serves no purpose.”

After seeing Manning led away to jail, defense attorney Moira Meltzer-Cohen said her client was standing up for principles.

"Whatever you think of her, Chelsea Manning is a principled person,” Cohen said. “She knows what it is to suffer.”

But prosecutors said Manning is not exempt from fulfilling her civic duty and noted that she was offered immunity so she could speak freely.

Incarceration, they said, is the only tool they have that could coerce Manning to testify.

“Miss Manning holds the keys to the jailhouse door,” Assistant U.S. Attorney Thomas Traxler said.

Earlier this month, Manning was freed following 62 days in a Virginia jail after refusing to testify before a previous grand jury in the WikiLeaks case.

She was released when the term of that grand jury expired. But then Manning was ordered to appear before a different panel in Alexandria on Thursday.

Download the NBC News app for breaking news and politics

Federal prosecutors in Alexandria recently unsealed an indictment issued in secret in late 2017 against WikiLeaks founder Julian Assange, who had been holed up in Ecuador’s embassy in London before his arrest by British authorities last month.

Manning, a former Army intelligence analyst, has said she objects to the secrecy of the grand jury process.

She also claims to have revealed everything she knows about WikiLeaks at her court-martial, where she was found guilty of leaking a trove of military and diplomatic documents to the anti-secrecy website.

Even before walking into court Thursday, she told reporters outside she wasn't going to cooperate.

"No matter what happens today ... whether I’m placed in confinement or not, I’m not going to comply with this grand jury," the former U.S. Army soldier said.

The threat of being locked up, Manning said, will have no effect on her.

"It doesn’t frighten me or disturb me," she said. "I mean, I’ve already been to jail. I’ve already been to prison, so attempting to coerce me with a grand jury subpoena is just not going to work."

Manning was sentenced to 35 years behind bars for leaking classified government documents. She served seven years of that term before then-President Barack Obama commuted her sentence.

"The goal here is to re-litigate the court martial," she said outside the courthouse Thursday. "They didn't like the outcome, I got out. This is a way of placing me back into confinement."