Bernard Madoff’s investors can’t sue the U.S. Securities and Exchange Commission for failing to uncover his massive Ponzi scheme, a federal appeals court ruled.

The regulator’s “regrettable inaction” is shielded by law, the New York-based appeals panel said today, upholding a lower-court decision to dismiss suits in which investors accused the SEC of negligence.

The three-judge panel ruled that the “discretionary function” exception to a law permitting people to sue the U.S. government applies in cases filed by Madoff victims.

“Despite our sympathy for plaintiffs’ predicament (and our antipathy for the SEC’s conduct), Congress’s intent to shield regulatory agencies’ discretionary use of specific investigative powers” defeats the investors’ claims, the court said.

In April 2011, U.S. District Judge Laura Taylor Swain in Manhattan threw out a $2.5 million suit filed two years earlier by investors Phyllis Molchatsky and Steven Schneider, who blamed the SEC’s grossly negligent oversight of Madoff’s firm for their losses.

Madoff, 74, pleaded guilty to orchestrating the biggest Ponzi scheme in history. He is serving a 150-year sentence in federal prison in North Carolina.

Howard Elisofon, a lawyer for Molchatsky, had no immediate comment on today’s decision.

The case is Molchatsky v. U.S., 11-02510, U.S. Court of Appeals for the Second Circuit.