Chelsea Manning will be a free woman in May.

In an eleventh-hour surprise, President Obama commuted most of Manning’s remaining prison sentence Tuesday, just days before he hands the keys to the White House to Donald Trump.

Manning, who was serving a 35-year sentence for leaking a trove of documents about the American military to WikiLeaks, will officially be released on May 17. She will have served a total of seven years.

Manning, formerly known as Bradley Manning, worked as an intelligence analyst in Iraq and stole hundreds of thousands of classified documents and turned them over to the website.

Manning said she hoped the release of the information would ignite “worldwide discussion, debates, and reforms.” But while it uncovered misdeeds of the US government, it landed Manning in jail, where she began the process of transitioning to a female.

Manning made a direct plea for a pardon from Obama, recently begging for her freedom following two suicide attempts in the past year.

“I am not asking for a pardon on my conviction,” she wrote in a November statement.

“I understand that the various collateral consequences of the court-martial conviction will stay on my record forever. The sole relief I am asking for is to be released from military prison after serving six years of confinement as a person who did not intend to harm the interests of the United States or harm any service members,” she added.

Obama also used his constitutional power to pardon Gen. James Cartwright.

Cartwright, the former vice chair of the Joint Chiefs of Staff, pleaded guilty to lying to the FBI by denying he was the source of classified information leaked to two reporters.

He was facing a two-year prison sentence.