FORT MEADE, Md. (AP) — Army Pfc. Bradley Manning’s possible sentence for disclosing classified information through WikiLeaks was trimmed from 136 years to 90 years Tuesday by a military judge who said some of his offenses were closely related.

The ruling was largely a victory for defense attorneys, who had argued for an 80-year maximum. Still, the 25-year-old soldier could spend most, if not all, of his remaining years inside a prison at Fort Leavenworth, Kansas.

The sentencing phase of Manning’s court-martial is in its second week. He was convicted last week of 20 counts, including six Espionage Act violations, five federal theft counts and a federal computer fraud charge for leaking more than 700,000 documents from a classified government computer network while working as an intelligence analyst in Iraq in 2010.

Manning says he leaked the material to expose wrongdoing by the military and U.S. diplomats. He contends he selectively leaked material that wouldn’t harm service members or national security.

At his sentencing hearing, prosecutors are presenting evidence that the leaks damaged U.S. interests. They have focused mainly on the impact of more than 250,000 State Department diplomatic cables that WikiLeaks began publishing in November 2010.

Maj. Gen. Michael Nagata testified for the prosecution Tuesday that the leaked cables had an impact on U.S. military operations in Pakistan, where he was deputy commander of a defense office within the U.S. embassy in Islamabad. Nagata saved the details of the impact for a closed court session to protect classified information.

The leaked cables publicly revealed a closer U.S.-Pakistani military relationship than Pakistan had publicly acknowledged. The cables also disclosed U.S. concerns Islamist militants could get their hands on Pakistani nuclear material to make an illicit weapon. One leaked cable revealed that instructors at a prestigious Pakistani defense institution were giving anti-American lessons to senior officers.

U.S. officials said in 2010 the leaked cables may have endangered operatives inside Afghanistan and Pakistan who had worked against the Taliban or al-Qaida. However, Pentagon spokesman Geoff Morrell said at the time that cables implying some Pakistani intelligence officials were aiding insurgents were “clearly out of step with where this relationship is now, and has been heading for some time.”

Prosecutors also have presented evidence the disclosures damaged America’s military and diplomatic relationships with some foreign governments and endangered the lives of foreign citizens who had confided in diplomats.