Winning the legal fight won't be as easy now that President Obama has changed his mind and will oppose a court ruling ordering the release of photos potentially showing detainee abuse at the hands of U.S. troops in Iraq and Afghanistan.

The next legal step is unclear, but it will be decided in the next few days, Pentagon spokesman Bryan Whitman said. It could include appealing the case to the Supreme Court, or perhaps revisiting it with the lower courts, he said.

Yet any legal move will put the Obama administration in the awkward position of fighting a pillar of its political base: the American Civil Liberties Union, which quickly lambasted Obama's decision.

"The decision to not release the photographs makes a mockery of President Obama's promise of transparency and accountability," said ACLU attorney Amrit Singh, who had argued and won the case before the 2nd U.S. Circuit Court of Appeals in New York. "It is essential that these photographs be released so that the public can examine for itself the full scale and scope of prisoner abuse that was conducted in its name."

Obama defended his decision Wednesday.

"My belief is the publication of these photos would not add any additional benefits to our understanding of what was carried out in the past by a small number of individuals," he said in a brief appearance. "The most direct consequence would be to further inflame anti-American opinion and put our troops in greater danger."

FOX News Radio: Former Insiders Pan Terror Tactics

YOU DECIDE: Photos a Danger to Troops?

Lawmakers who urged Obama to fight the release of the photos are planning to assist Obama.

Sens. Joe Lieberman, I-Conn., and Lindsey Graham, R-S.C., said Wednesday they plan to offer an amendment next week to a bill to prohibit the release of those types of photos "until some period after the end of hostilities." 

Despite a lack of detail, Lieberman called it "one of the great balancing acts" between openness and risk. 

Graham brushed aside concern that the courts may wind up ruling against the government. 

"So be it," he said. "We're a rule-of-law nation, and we'll respect that result. But it's good for the troops to know that their commander in chief is going to bat for them, and that's what he did today."

White House spokesman Robert Gibbs, however, said the president believes the government has a strong argument to make in the legal battle.

"The president does not believe that the strongest case regarding the release of these photos was presented to the court," Gibbs said, explaining that the new argument is based on national security implications of releasing the photos.

Gibbs said the previous administration never made that argument.

"They argued a couple of different things, including, a law enforcement exception," Gibbs said, noting that the judge ruled against them. "This is a different argument that the president thinks is compelling."

The administration said last month it would not fight a court order and agreed to release the photos by May. 28. Federal appeals judges had ruled in favor of a Freedom of Information Act lawsuit filed by the ACLU.

The Justice Department had concluded that further appeal would probably be fruitless. At the time, Gibbs said the president had concurred with Justice's conclusion, though without commenting on whether Obama would support the release if not pressed by a court case.

The Obama administration had assured a federal judge that it would turn over the material by May 28, including one batch of 21 photos and another of 23 images. The government also told the judge it was "processing for release a substantial number of other images," for a total expected to be in the hundreds.

But Obama informed his legal team last week that he did not feel comfortable with the release, concerned they would inflame tensions in Iraq and Afghanistan and make the U.S. mission in those two wars more difficult, Gibbs said.

The effort to keep the photos from becoming public represented a sharp reversal from Obama's repeated pledges for open government, and in particular from his promise to be forthcoming with information that courts have ruled should be publicly available.

As such, it was sure to invite criticism from people, including more liberal segments of the Democratic Party, that want a full accounting -- and even redress -- for what they see as the misdeeds of the Bush administration.

Gibbs emphasized that the president continues to believe that the actions depicted in the photos should not be excused and supports the investigations, prison sentences, discharges and other punitive measures that have resulted from them.

He said the new decision does not contradict Obama's promises of transparency, since details about investigations into the abuse are available on the Pentagon's Web site. "The notion that somehow you don't know about these investigations because you haven't seen the photos doesn't make any sense," he said.

FOX News' Trish Turner and The Associated Press contributed to this report.