Chelsea Manning, the US soldier imprisoned for spilling state secrets, has said in an interview that much of her life has been marked by a lonely anguish over her gender identity.

In her first interview from Fort Leavenworth military prison where she is serving out a 35-year sentence for a massive leak of classified documents, Manning, 27, described her life behind bars in an article published Wednesday in Cosmopolitan magazine.

She said she is pained by rules that still forbid her from growing her hair long.

After Manning, formerly known as Bradley Manning, was convicted and sentenced in 2013 for the massive document dump, the US Army private announced she was a female and requested medical treatment -- including hormone therapy -- to enable her to become a woman.

Manning has won partial legal victories and judges have backed her request to be referred to as a woman. But while she is undergoing hormone therapy and allowed make-up and female underwear, authorities do not permit Manning to grow her hair long.

Her appeals for medical care have been difficult because she feels "like a joke" to military officials, Manning told the magazine.

It is "painful and awkward" to be banned from letting her hair grow, Manning said.

"I am torn up," Manning said. "I get through each day OK, but at night, when I'm alone in my room, I finally burn out and crash."

The magazine interview was conducted by mail, as military authorities prohibit inmates from speaking to journalists by phone or in person.

Growing up in a conservative household in Oklahoma, Manning said she felt different as a child and liked to dress in her sister's clothes from a young age.

Manning said she faced cruel bullying as a youth and often felt isolated and disconnected.

- 'Going through phases' -

"I spent a lot of time denying the idea that I could be gay or trans to myself. From the ages of 14 to 16, I was mostly convinced that I was just going through 'phases,'" she said.

Manning said letters sent to her from transgender people around the world have moved and inspired her.

"I am always flattered that they feel that I have inspired them in some way," she said. "But honestly, I think it's the other way around: They inspire me more than I think they might realize."

The other inmates have treated her well, she said.

"The guys here are adults . . . There are some very smart and sophisticated people in prisons all across America -- I don't think television and the media give them credit," she said.

At the prison in Kansas, Manning has her own cell with "two tall vertical windows that face the sun."

She can see "trees and hills and blue sky and all the things beyond the buildings and razor wire," she said.

Manning spends a lot of time in the prison library, working towards a university degree in political science, the magazine reported.