Better Markets Inc, a nonprofit critical of Wall Street, had in February accused the government of "unilaterally" engineering a backroom accord giving JPMorgan "blanket civil immunity" for selling shoddy mortgage securities before the financial crisis.

It said this violated the constitutional separation of powers and called for a judge to review the November settlement.

The accord included a $2 billion fine payable to the U.S. Department of Justice. The Better Markets case was prompted by the department's decision not to make its accusations public in a lawsuit before settling with JPMorgan.

In a court filing on Monday night, however, the Justice Department said its decision to settle was "presumptively" unreviewable, and that Better Markets lacked standing to sue.

The department also rejected Better Markets' suggestion that it had "abdicated" its law enforcement duties by not driving a harder bargain with JPMorgan and chief executive Jamie Dimon.

It noted that the civil settlement was the largest in U.S. history, dwarfing the $3 billion that JPMorgan once proposed, and that reopening it could take billions of dollars from people it was meant to help: troubled homeowners.

The Justice Department's power "to settle claims of the United States is undiminished, and that includes 'the power to make erroneous decisions as well as correct ones,'" the department said, citing a 1928 U.S. Supreme Court decision.

"Plaintiff's claim that DOJ's decision to settle was arbitrary and capricious, or an abuse of discretion, must ... fail," it added.

Dennis Kelleher, chief executive of Better Markets, in a statement said the filing "doubles down on secrecy" by concealing the "full truth" of JPMorgan's wrongful activity.

"The executive branch through DOJ simply cannot, on its own and without any review or approval by anyone, including the courts, cut such an historic deal and leave the American public in the dark," Kelleher said.

The JPMorgan accord earmarked $4 billion for homeowners harmed by the New York-based bank and two others it had bought, Bear Stearns Cos and Washington Mutual Inc, and $9 billion to resolve federal and state claims.

Justice Department officials have also held talks with Bank of America Corp, the No. 2 bank in the United States, to settle claims over that lender's sale of mortgage securities, people familiar with the matter have said.

On Monday, Credit Suisse Group AG became the largest bank in two decades to plead guilty to a U.S. criminal charge, admitting to conspiring to aid tax evasion and agreeing to pay $2.6 billion in penalties.

The case is Better Markets Inc v. U.S. Department of Justice et al, U.S. District Court, District of Columbia, No. 14-00190.

(Reporting by Jonathan Stempel in New York; Additional reporting by Aruna Viswanatha in Washington, D.C.; Editing by Grant McCool)

By Jonathan Stempel