US soldier Chelsea Manning has ended her hunger strike after being allowed by the army to receive gender transition surgery, the American Civil Liberties Union says.

Key points: Manning born a male, but identifies as a woman

Manning born a male, but identifies as a woman Staged a hunger strike demanding gender transition surgery

Staged a hunger strike demanding gender transition surgery Will be first US inmate to receive gender affirming surgery

The 28-year-old army private, who is serving a 35-year prison term for passing classified files to WikiLeaks, announced the hunger strike on Friday.

Manning was born male but revealed after being convicted of espionage that she identifies as a woman.

Her treatment will begin with the surgery that was recommended by her psychologist in April, the ACLU, which represented Manning, said in a statement.

She is being held in Kansas.

No transgender inmate has ever before received gender affirming surgical treatment in prison, the ACLU said.

"I am unendingly relieved that the military is finally doing the right thing. I applaud them for that," Manning said in a statement.

"This is all that I wanted — for them to let me be me."

However, she went on to criticize the Government for taking "so long".

A representative for the US Department of Defense could not immediately be reached for comment.

Manning in July tried to take her own life over what her representatives said was the Government's denial of appropriate treatment for her gender dysphoria, a condition in which a person feels their physical gender is the opposite of the one he or she identifies with.

The army announced later that month that it would investigate Manning for misconduct in connection with the attempt to take her own life, a probe that could lead to indefinite solitary confinement, reclassification into maximum security or additional prison time.

Chelsea Manning, who was born Bradley Manning but identifies as a woman, was imprisoned for leaking classified files to WikiLeaks.

According to her representatives, doctors have recommended that as part of her treatment for gender dysphoria the soldier, who began hormone therapy in 2015, be allowed to follow "female hair grooming standards".

ACLU staff attorney Chase Strangio said in statement that the Government planned to still enforce the male hair standards.

Manning, a former intelligence analyst in Iraq, was sentenced in 2013 to 35 years in prison after a military court conviction of providing more than 700,000 documents, videos, diplomatic cables and battlefield accounts to the anti-secrecy group WikiLeaks.

The case ranked as the biggest breach of classified materials in US history.

Reuters