California's highest court on Monday ruled that Bank of America Corp need not pay a potential $1 billion or more to customers who claimed the bank illegally raided Social Security benefits to collect fees.

Plaintiffs in the class-action case had accused the largest U.S. bank of dipping into their Social Security direct deposit accounts between 1994 and 2003 to collect fees for overdrafts and other debts.

A San Francisco trial court in 2004 ordered the Charlotte, North Carolina bank to pay $284.4 million of damages, plus up to $1,000 to each customer who suffered substantial emotional or economic harm. The case was filed on behalf of more than 1.1 million customers, many of whom were elderly or disabled.

In 1974, the California Supreme Court had ruled that a bank may not satisfy a credit card debt by deducting fees owed from a separate checking account containing deposits that derived from unemployment and disability benefits.

But in Monday's unanimous ruling, the court distinguished the current case by saying the transactions at issue occurred within a single account rather than in multiple accounts.

It said policy concerns about setting off independent debt, such as the importance of providing people with a stream of income to defray the cost of their subsistence, were not present in this case.

We do not agree with plaintiffs that there is no meaningful difference between satisfying a debt external to an account and recouping an overdraft of an account from funds later deposited into that same account, Justice Carlos Moreno wrote for the court.

Monday's ruling upheld a 2006 appeals court decision that had reversed the trial court ruling. Paul Miller, a disabled former photojournalist, was the original plaintiff in the case, and a jury had awarded him $275,000.

James Sturdevant, a lawyer for the bank customers, in a statement labeled Monday's decision disgraceful, and called for laws making clear that exempt benefits are exempt, without qualification and without special exceptions for national banks, which are among the most avaricious of creditors.

Bank of America said it was pleased with the ruling, which it said rejected a challenge to account balancing practices followed by every bank in California and across the nation.

Shares of Bank of America ended down 6 cents, or 0.5 percent, at $11.21 on the New York Stock Exchange.

The case is Miller v. Bank of America, California Supreme Court, No. S149178.

(Reporting by Jonathan Stempel; Editing by Steve Orlofsky)