Washington (CNN) President Barack Obama on Tuesday overruled his secretary of defense to commute the sentence of former Army soldier Chelsea Manning, who was convicted of stealing and disseminating 750,000 pages of documents and videos to WikiLeaks.

The decision -- which a senior defense official told CNN was made over the objections of Secretary of Defense Ash Carter -- immediately touched off a controversy in the closing days of the Obama administration.

A former intelligence official described being "shocked" to learn of Obama's decision, adding that the "entire intelligence community is deflated by this inexplicable use of executive power." The official said the move was "deeply hypocritical given Obama's denunciation of WikiLeaks' role in the hacking of the (Democratic National Committee)."

The President also pardoned James Cartwright, the former vice chairman of the US Joint Chiefs of Staff, who pleaded guilty in October to a single charge of making false statements to federal investigators in 2012 when he was questioned about leaking top secret information on US efforts to cripple Iran's nuclear program to two journalists.

A presidential commutation reduces the sentence being served but it does not change the fact of conviction, whereas a pardon forgives a certain criminal offense.

Manning, a transgender woman, was serving a 35-year sentence at Fort Leavenworth, an all-male Army prison in eastern Kansas, despite her request to transfer to a civilian prison. A White House statement on Tuesday said her prison sentence is set to expire on May 17.

JUST WATCHED Who is Chelsea Manning? Replay More Videos ... MUST WATCH Who is Chelsea Manning? 01:31

The material, which WikiLeaks published in 2010, included a classified video of a US helicopter attacking civilians and journalists in Iraq in 2007. Labeled "Collateral Murder," the film drew criticism from human rights activists for the deaths of innocent people.

Though found guilty on 20 out of 22 possible charges (including violating the US Espionage Act), Manning was not convicted of the most serious one; aiding the enemy, which could have earned the private a life sentence.

Instead, the former intelligence analyst was sentenced to prison, as well as demoted from private first class to private and dishonorably discharged.

Nancy Hollander, an attorney for Manning, told CNN the former soldier has been "nervous the last few days" as she waited for word in the closing days of the Obama administration. Hollander said she only learned of the commutation around the time Obama made the announcement.

"She knows she's going to be free," Hollander said. "She can start her life."

Surprise decision

Asked to describe the difference between the situations of Manning and former National Security Agency contractor Edward Snowden, who is living in exile in Russia after leaking state secrets, a source with knowledge of the White House's thinking said there was a "fundamental difference" between the two.

Snowden, the source said, "dodged blame, fled the country and is hiding from prosecution," whereas Manning admitted guilt without a deal and eventually confessed.

"She went through the process, acknowledged she had done something wrong. She was tried and sentenced," the source said.

The White House is aware that the intelligence community and the Pentagon may be dismayed by the decision, but, the source added, this "doesn't set a precedent if you consider the distinction between the two of them to be material."

Part of the thinking was that Manning's term was quite "extreme" and "without historical precedent" and she had already served more than six years, the source said, adding that another factor is the personal and emotional side of the Manning story: she is transgender, in a male prison, "facing an uncertain fate behind bars."

Snowden tweeted his support of Manning Tuesday, urging her to "stay strong a while longer."

Let it be said here in earnest, with good heart: Thanks, Obama. https://t.co/IeumTasRNN — Edward Snowden (@Snowden) January 17, 2017

President-elect Donald Trump did not immediately comment on the matter, but when asked about WikiLeaks in the wake of the releases in 2010, he told Fox News' Brian Kilmeade: "I think it's disgraceful. I think there should be like death penalty or something."

WikiLeaks declares 'victory'

Earlier this month, WikiLeaks said it would agree to a US extradition request for the site's founder, Julian Assange, if Obama granted clemency to Manning. It was not immediately clear if WikiLeaks would make good on its promise, though the group declared "victory" in a tweet Tuesday afternoon.

JUST WATCHED Who is Julian Assange? Replay More Videos ... MUST WATCH Who is Julian Assange? 01:53

A senior administration official insisted Tuesday that Obama's decision "was not influenced in any way by public comments by Mr. Assange or the WikiLeaks organization."

Chase Strangio, an attorney for the American Civil Liberties Union, which represented Manning, said he was "relieved and thankful" Obama commuted her sentence, and Amnesty International also cheered news of Manning's commutation.

"Chelsea Manning exposed serious abuses, and as a result, her own human rights have been violated by the US government for years," Margaret Huang, the group's executive director, said in a statement. "President Obama was right to commute her sentence, but it is long overdue. It is unconscionable that she languished in prison for years while those allegedly implicated by the information she revealed still haven't been brought to justice."

Republican members of Congress, however, expressed outrage.

"This was grave harm to our national security. and Chelsea Manning is serving a sentence and should continue to serve that sentence," Sen. Tom Cotton, R-Arkansas, told CNN's Jake Tapper on "The Lead."

House Speaker Paul Ryan, denouncing Manning's "treachery," said on Twitter that she "put American lives at risk and exposed some of our nation's most sensitive secrets."

And South Carolina Sen. Lindsey Graham told CNN that Manning "stabbed his fellow soldiers in the back" and Obama "slapped all those who serve honorably in the face."

Two-year sentence sought for Cartwright

Cartwright's career was marked by decades of distinguished military service. From August 2007 to August 2011, he served as the second-highest uniformed officer and, before that, he served as commander of US Strategic Command. During his tenure in these posts, he held the highest security clearance, and retained top security clearance upon his retirement from the military in 2011.

JUST WATCHED Retired general pleads guilty in leak case Replay More Videos ... MUST WATCH Retired general pleads guilty in leak case 00:59

The senior administration official said Cartwright's motive mattered in Obama's decision to pardon him, calling it "different than most people who leak info to journalists."

"We are deeply grateful for President Obama's decision to pardon General Cartwright. ... Current and former leaders of the American national security community have, almost with one voice, stood up for General Cartwright. We thank them for supporting a man who is truly one of our nation's heroes," Cartwright's attorney and former White House counsel, Gregory Craig, said in a statement.

Federal prosecutors had sought a two-year prison sentence for Cartwright in court filings earlier this month, but his attorneys asked for probation, emphasizing his desire to persuade journalists to modify their reporting to protect national security interests.

"General Cartwright understands the magnitude of his offense and deeply regrets the decision that he made ... He has accepted responsibility and acknowledged his guilt," his attorneys wrote in court papers.

"(I)n General Cartwright's communications with both journalists, he successfully persuaded them not to report information that would be harmful to the United States."

One of those reporters, David Sanger of The New York Times, submitted a letter in support of Cartwright explaining that "throughout the interview, (Cartwright) consistently showed his concern that information damaging to US interests not be made public."

The other reporter, Daniel Klaidman, who wrote for Newsweek, also submitted a letter on Cartwright's behalf, as did several current and former members of Congress, along with military officials from the Bush and Obama administrations, all urging the judge for leniency in light of Cartwright's decorated military career.

Cartwright, 67, served 40 years in the US Marine Corps and was widely regarded within the military for his technical acumen and work in the areas of nuclear proliferation, missile defense and cybersecurity.

He was scheduled for sentencing before DC District Court Judge Richard Leon on January 31.