Chelsea Manning, the former Army intelligence analyst sentenced to 35 years in prison for leaking a trove of secret documents to WikiLeaks, has joined The Guardian newspaper as a contributing opinion writer.

Ms. Manning, formerly known as Pfc. Bradley E. Manning, will write on war, gender and freedom of information, said Katharine Viner, the editor in chief of Guardian US, the newspaper’s American operation.

She had contributed to the newspaper on a casual basis, a spokesman said, but the agreement has now been made formal. She will write when stories come up, and not on a set timetable or schedule.

Ms. Manning, 27, was incarcerated for providing more than 700,000 government files to WikiLeaks, including 250,000 diplomatic cables, dossiers on Guantánamo Bay, Cuba, and incident reports from the wars in Iraq and Afghanistan. She is being held at Fort Leavenworth, Kan., and will be eligible for parole in about 2020. Ms. Manning began transitioning to a woman last year.