Chelsea Manning, the rogue US Army intelligence expert turned WikiLeaks whistblower, was granted clemency by president Barack Obama on Tuesday (17 January 2017), just days before he is due to exit the White House and hand over power to president-elect Donald Trump.

She was one of 1,597 people who were granted a "second chance" by Obama during his term as commander-in-chief, and – at least according to her supporters – more than deserved it after spending a seven-year spell at a military prison at Fort Leavenworth, Kansas.

Yet detractors argue that her disclosures cost lives and hurt the efforts of US intelligence to protect America. On the day the sentence commute was announced, House Speaker Paul Ryan called it outrageous and claimed it would set a "dangerous precedent." Here's what you need to know.

Who is Chelsea Manning?

Chelsea Manning, 29, is a former US Army Private First Class who leaked hundreds of thousands of classified documents detailing the inner-workings of the US military to WikiLeaks, the whistleblowing outfit founded and managed by Julian Assange.

Formerly known as Bradley Manning, the army analyst, who liked to hang out in hacker communities online, became increasingly frustrated with the military after being deployed to Iraq in 2009 and began a stealthy attempt to gather – and eventually leak – secretive data about the war.

Manning was diagnosed with gender-identity disorder while in the US Army and continued to fight for the right for a sex change long after her arrest. During this time, Manning reportedly became disheartened with US actions during the war – and the morality of its soldiers.

"I felt that we were risking so much for people that seemed unwilling to cooperate with us, leading to frustration and anger on both sides," Manning said. "I began to become depressed with the situation that we found ourselves increasingly mired in year after year."

The disillusionment resulted in attempts to probe further into alleged crimes and corruption orchestrated by the US military, and eventually, the smuggling of troves of internal data outside of military computers (in a Lady Gaga-marked CD, no less) and into the inbox of Assange.

Chelsea Manning
Army Private First Class Chelsea Manning is escorted by military police as she leaves a military trial on 30 July 2013 at Fort George G Meade, Maryland Mark Wilson/Getty Images

What was leaked?

The documents were not given such names at the time, of course, but they came to be known around the world as 'Collateral Murder', the 'Afghan War Logs', the 'Guantanamo Bay files' and 'Cablegate' – the latter an embarrassing selection of US diplomatic communications.

There was roughly 720,000 documents in total, and – at the time – it was the largest leak of classified military secrets in history. The files were released by WikiLeaks, in partnership with a multitude of traditional media outlets, including The Guardian and The New York Times.

"I felt this sense of relief by [WikiLeaks] having [the information]," Manning said in a testimony during her trial. "I felt I had accomplished something that allowed me to have a clear conscience based upon what I had seen and what I had read about and knew were happening in both Iraq and Afghanistan every day."

How was Manning caught?

After handing the material to WikiLeaks, Manning confided in a former hacker called Adrian Lamo, who then went to US authorities and reported her. Manning was arrested by the US Army on 27 May 2010 and, a year later, charged with 22 offences.

The trial started in June 2013, and by the end of the next month Manning was convicted of 17 of the 22 charges in their entirety – including counts under the infamous Espionage Act. She was acquitted of aiding the enemy as the trial continued.

In August that year, she was sentenced to 35 years in prison. "I am sorry for the unintended consequences of my actions [...] I believed I was going to help people, not hurt people [...] at the time of my decisions I was dealing with a lot of issues," she said in court.

The same month, Manning, then still called Bradley, declared: "I am Chelsea Manning. I am a female."

In a public statement, she added: "As I transition into this next phase of my life, I want everyone to know the real me. Given the way that I feel, and have felt since childhood, I want to begin hormone therapy as soon as possible."

Chelsea Manning
Protesters demonstrating in support of Bradley Manning on 21 August 2013 in front of the White House in Washington, DC. T.J. Kirkpatrick/Getty Images

What happened next?

Over the next few years, Manning had a troubled time in prison. In 2016, she made multiple suicide attempts, and as a result was put under investigation and forced into solitary confinement. In September this year, Manning began a hunger strike.

As 2016 came to an end, a campaign emerged asking Obama to grant Manning clemency, and on 14 December, more than 110,000 signatures were sent to the White House. On Tuesday he did just that – with the former solider now set for release on 17 May.

"This move could quite literally save Chelsea's life, and we are all better off knowing that Chelsea Manning will walk out of prison a free woman, dedicated to making the world a better place and fighting for justice for so many," said Manning's attorney Chase Strangio.