Chelsea Manning attempted suicide on Wednesday inside her Virginia jail cell ahead of a scheduled court appearance, her legal team said.

“Chelsea Manning attempted to take her own life,” the legal team said in a statement to The Post. “She was taken to a hospital and is currently recovering.”

The Army intelligence officer-turned-leaker has been held at the Alexandria Detention Center for nearly a year after refusing to testify before a grand jury that is investigating WikiLeaks.

Manning, 32, was and is still scheduled to appear before a judge on Friday regarding a motion to squash the civil contempt sanctions that landed her in jail.

A defiant Manning has said she’d “rather starve to death” than testify and pledged to stay in jail “forever” if she had to.

“I object to this grand jury … as an effort to frighten journalists and publishers, who serve a crucial public good,” she wrote in a 2019 letter to the judge in her case, Anthony Trenga.

Her lawyers said her actions on Wednesday “evidence the strength of her convictions, as well as the profound harm she continues to suffer as a result of her ‘civil’ confinement.”

Manning previously spent seven years in military prison for leaking thousands of sensitive and classified documents to WikiLeaks.

President Obama commuted the remainder of her 35-year sentence just days before handing the White House over to President Trump.