Alexandria, Virginia (CNN) A judge has held Chelsea Manning in contempt and she is being detained after refusing to testify about her disclosure of military and diplomatic secrets to WikiLeaks in 2010, her lawyer says.

The former Army intelligence analyst, who served about seven years in prison for the massive leak, objected to the questioning in a grand jury appearance Wednesday in Virginia.

Her testimony appears to be part of a continued effort by federal prosecutors investigating the founder of WikiLeaks, Julian Assange

"Imprisoning me for my refusal to answer questions only subjects me to additional punishment for my repeatedly-stated ethical objections to the grand jury system," Manning said in a statement Friday posted on her Twitter account.

Manning's attorney, Moira Meltzer-Cohen, said she would likely appeal the order by Judge Claude M. Hilton, and that Manning could be held behind bars for the term of the grand jury but not longer than 18 months. Asked if Manning was prepared to stay imprisoned for 18 months, Meltzer-Cohen said, "We are not there yet."

"As everybody knows, Chelsea has tremendous courage. Our primary concern at this point is her health while she is confined and we will be paying close attention," Meltzer-Cohen told reporters outside the courthouse in Virginia after the contempt hearing.

Manning said this week that she had been offered immunity as part of her grand jury testimony.

A prosecutor at the contempt hearing Friday, Tracy Doherty-McCormick, said that "the government does not want to confine Ms. Manning."

"It has always been our intent and hope for her to testify and comply with the valid court order and valid grand jury investigation. Ms. Manning could change her mind right now and do so. It is her choice," Doherty-McCormick said in court.

The hearing Friday was held mostly under seal, and the prosecutor's statement was provided by a spokesman for the US Attorney's Office for the Eastern District of Virginia, where the hearing was held.

Manning was arrested in 2010 and later charged with leaking thousands of classified files. After an eight-week military trial in 2013, she was found guilty of several counts, including violations of the Espionage Act, and sentenced to 35 years in prison. That sentence was commuted by President Barack Obama in 2017.

Officials questioned Manning under oath about the leak for several hours as part of the court-martial. "The grand jury's questions pertained to disclosures from nine years ago and took place six years after an in-depth computer forensics case, in which I testified for almost a full day about these events. I stand by my previous public testimony," Manning said Friday.

WikiLeaks and Assange, who is holed up in Ecuador's Embassy in London, have factored into the investigation by special counsel Robert Mueller into potential collusion between Russia and President Donald Trump's campaign.

Prosecutors on the special counsel team said in a court filing last month that they have evidence of longtime Trump associate Roger Stone communicating with WikiLeaks, but did not elaborate further on the content of those communications.

In his public testimony to Congress last week, former Trump attorney Michael Cohen alleged that he had witnessed a speakerphone call between the then-candidate and Stone, an informal campaign adviser, where Stone told Trump that he had "just gotten off the phone with Julian Assange" and had learned that "there would be a massive dump of emails that would damage Hillary Clinton's campaign."

Stone -- who has been indicted on charges of making false statements, witness tampering and obstructing justice -- has denied discussing the matter with Trump or having any such interactions with WikiLeaks. He is fighting his charges in court.

Prosecutors' interest in Assange, however, dates to 2010, when his site first posted the files leaked by Manning, which included millions of State Department cables and a classified video of a US helicopter firing on civilians and journalists in Iraq in 2007.

The fact that a grand jury is interested in hearing about Manning's interactions with WikiLeaks in 2010 could indicate that the Justice Department is still interested in pursuing Assange in relation to the publication of those sensitive documents.

Last year, prosecutors in the Eastern District of Virginia, where Manning was subpoenaed to appear before the grand jury, mistakenly revealed in a court filing that they had prepared sealed charges against Assange.

Another judge in the same court this year declined a reporters group's motion to unseal those charges.

The federal prosecutor who tried that case, Gordon D. Kromberg, also requested the subpoena compelling Manning's testimony earlier this year, according to a copy of the subpoena provided to CNN by a representative for Manning.