On Tuesday, three days before the end of Barack Obama’s term as President, the White House announced that he had commuted the sentences of two hundred and nine people, including Private Chelsea Manning, who was arrested, in 2010, for giving hundreds of thousands of files classified as secret—the revelation of which caused diplomatic tumult and other difficulties for the United States—to WikiLeaks. Manning had been court-martialed and sentenced to thirty-five years in military prison. Under Obama’s order, she will be released in May, after being incarcerated for more than six years. Here are five reasons that Obama’s decision on Manning was the right and just move.

1. When she was a soldier in a war zone, the Army failed her terribly.

“Hey, what are we doing about this soldier?” a lieutenant in an intelligence unit in Iraq asked a colleague when Manning, who was then twenty-two years old and still identified as Bradley, showed every sign of going through an emotional breakdown. That day, Manning had flipped over a table; other times, people found Manning, who had joined the military seeking refuge from a childhood contorted by her parents’ alcoholism, on the floor, crying. The response at the undermanned outpost was to send Manning back to the computer—and to the task of processing classified battlefield intelligence, with its accounts of death and the relentless moral tragedies of war. Soon after, Manning downloaded hundreds of thousands of files and sent them to WikiLeaks—and it says a great deal about the absurdities of our classification system that this young soldier had access to so much material. A couple of months later, Manning, still an enlisted soldier, e-mailed a supervisor a photograph of herself wearing a wig, with the caption “My Problem,” and was nonetheless sent back to work. (The military's Don’t Ask, Don’t Tell policy was still in effect, adding to the pressure.) Quite apart from whether the Army ought to have spotted a security risk, Manning deserved help, like any soldier, and didn’t get it.

2. Her sentence was out of proportion to her crime**.**

There is a sense in which Manning’s crime was unprecedented, in terms of the number of files, which she hadn’t read—a harbinger of an age of mass data leaks. Still, her thirty-five-year sentence was not just the longest ever handed down for giving classified national-security information to the press but, according to a tally made by Gabe Rottman, a lawyer for the A.C.L.U., which has worked tirelessly on her behalf, it was almost ten times as long as the next harshest, for Donald Sachtleben, a former F.B.I. agent. And it was twenty times as long as the most severe sentence ever given for such actions prior to the Obama Administration, which has been notably tough on leakers and has seen a record number of prosecutions under the Espionage Act. (When it was handed down, my colleague John Cassidy called the sentence “draconian.”) Counting Manning’s pre-sentencing detention, she has already served more time than anyone else has been sentenced to for similar acts.

3. The military has not handled her incarceration well.

Manning tried to kill herself last year and her military jailers, at Fort Leavenworth, responded by putting her in solitary confinement, which seems to have torn her further apart. She had already been held for an excessively long period of time in solitary at Quantico immediately after her arrest, in notably bleak conditions. She has at times been deprived of all clothing but a smock and subjected to the kind of petty humiliations that come too easily in a prison. Some of the treatment (although not all of it) was doubtless due to misjudgments about the best way to respond to Manning’s status as a transgender woman in a maximum-security men’s prison, rather than to bad will or hostility, but that simply raises the question of how her treatment might change in a different political climate. (Despite going to court, she has only been partially successful in getting medical help to aid in her transition.) Every day that Manning has served in prison has been a struggle.

4. She has taken responsibility.

This one seems to have really mattered to Obama. Last week, Josh Earnest, the White House press secretary, went out of his way to make the point to reporters, while drawing a distinction between Manning and Edward Snowden. “Chelsea Manning is somebody who went through the military criminal-justice process, was exposed to due process, was found guilty, was sentenced for her crimes, and she acknowledged wrongdoing,” Earnest said. Indeed, Manning seems to have realized that, as much as she may have wanted Americans to understand the horrors of war—and as much as some of the files she leaked, particularly about civilian deaths in Iraq, helped them to do so—indiscriminately putting the bulk information she had access to in the hands of Julian Assange was not a well-thought-out move. (WikiLeaks had tweeted that Assange would agree to extradition to the United States if Manning was granted clemency; we’ll now see what that means.) Manning, before her trial, entered a guilty plea on ten charges, which would have been enough to send her to prison for twenty years. She did so not as part of a plea deal but as an act of unforced penance that the government, for whatever reason, was not ready to accept. It pursued more charges under the Espionage Act, and also adopted an ambitious (and, from a press-freedom perspective, alarming) legal theory to argue that Manning was guilty of “aiding the enemy.” She was acquitted on that last count, at least. In her application for a commutation, Manning said that she understood why a request she had made for a pardon soon after her sentencing had been turned down. “It was too soon, and the requested relief was too much. I should have waited. I needed time to absorb the conviction, and to reflect on my actions. I also needed time to grow and mature as a person.” The “sole relief” she was asking for was release after six years of confinement.

5. This is a good moment to reconsider the zealous prosecution of leakers.

We are about to enter the land of the Trump Administration, which is likely to be characterized not only by a lack of transparency, in the closed-door sense, but by outright lies. In that case, the country may need leakers more than ever. (Paul Ryan, the Speaker of the House, saw it the opposite way, calling the commutation “outrageous” and “a dangerous precedent that those who compromise our national security won’t be held accountable for their crimes.”) Perhaps Obama has, to some extent, realized that his Administration’s leak-chasing was not the practice most protective of American democracy. And maybe, with the Manning commutation—and with his pardon, also announced on Tuesday, of General James Cartwright, who had pleaded guilty to misleading the F.B.I. about his discussions with a Times reporter—he is acknowledging that. The President may be too late to save press freedom, but he might, with this action, have saved Chelsea Manning’s life. And that is something very valuable.