Pvt. Chelsea Manning, the Army soldier who was sentenced to 35 years in a military prison for giving classified materials to WikiLeaks, walked free Wednesday after seven years behind bars. Here’s a timeline of key moments of the case:

2007: Manning, then known as Bradley Manning, joins the Army and trains in Arizona as an intelligence analyst.

April 5, 2010: WikiLeaks posts a classified military video shot from the cockpit of an Apache helicopter showing a group of men being gunned down in Baghdad by American airmen.

May 21: 2010 Manning, working in Baghdad as an intelligence analyst, begins communicating with R. Adrian Lamo, a former computer hacker convicted of breaking into the New York Times computer system in 2004. Manning claimed to have sent 260,000 State Department cables to WikiLeaks after copying compact discs of data, according to chat logs Lamo submitted to Wired.com.

May 29, 2010: Manning is detained by military authorities on suspicion of leaking the classified video.

July 10, 2010: Manning is charged with multiple counts of mishandling classified data and putting national security at risk. The charges include putting the classified video of the helicopter shooting on a personal computer and accessing more than 150,000 classified State Department cables.

July 29, 2010: Manning is moved from Kuwait to Marine Corps Base Quantico, Virginia, to await trial.

Sept. 1, 2010: Manning’s civilian attorney, David E. Coombs, says his client under psychiatric care and undergoing tests amid concern that Manning is suicidal.

March 2, 2011: The government files 22 new counts against Manning, including the charge of aiding the enemy — a crime that could carry the death penalty.

March 13, 2011: Manning is held in solitary confinement 23 hours a day, stripped naked each night and given a suicide-proof smock to wear to bed. Amnesty International says the treatment may violate Manning’s human rights. State Department spokesman P.J. Crowley resigns after causing a stir by describing Manning’s treatment in the Quantico brig as “ridiculous” and “stupid.”

April 20, 2011: Manning is transferred from Quantico to an Army prison at Fort Leavenworth, Kansas, and is allowed to live with other inmates.

July 22, 2011: The military finds Manning is fit to stand trial.

Feb. 3, 2012: Military District of Washington commander Maj. Gen. Michael Linnington refers all charges against Manning to a general court-martial, passing along the recommendation of the lower-level officer presiding over the Article 32 hearing.

Feb. 23, 2012: Manning declines to enter a plea to 22 charges, including aiding the enemy, at an arraignment at Fort Meade near Baltimore.

Feb. 28, 2013: Manning pleads guilty to leaking military information.

June 3, 2013: Court martial trial begins.

July 30, 2013: Manning convicted on several espionage charges.

Aug. 21, 2013: Manning is sentenced to 35 years in prison. The next day, she announces she is transgender and requests to be known as Chelsea.

Sept. 23, 2014: Manning sues in federal court in the District of Columbia, asking a judge to order the Defense Department to provide hormone therapy and other treatment for her gender identity condition. The lawsuit claims Manning is at a high risk of self-castration and suicide unless she receives more focused treatment for gender dysphoria, and that she is getting psychotherapy from a mental health specialist who lacks the qualifications to treat gender dysphoria.

July 5, 2016: Manning tries to kill herself in the military lockup at Kansas’ Fort Leavenworth, according to her attorneys.

September 2016: Manning ends a several-day hunger strike after the Army agrees to allow her to receive medical treatment for her gender dysphoria.

October 2016: Manning’s attorneys announced that she attempted suicide for the second time in recent months at Kansas’ Fort Leavenworth. The attorneys cited her prison conditions, including the solitary confinement that her legal team says she received as punishment for her July suicide attempt, as contributing to their client’s fragile mental state.

November 2016: Manning asks President Barack Obama to commute her sentence to time served.

Jan. 17, 2017: Days before leaving office, Obama grants clemency to Manning. LGBT rights activists, who warned about Manning’s mental health and treatment as a transgender woman living in a men’s prison, cheered Obama’s move. National security hawks who said she did devastating damage to U.S. interests countered that the commutation was an outrageous act that set a dangerous precedent.

May 17, 2017: Manning is released from lockup at Kansas’ Fort Leavenworth, on the date Obama’s clemency order had directed.