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 2004 San Francisco trial court ordered the Charlotte, North Carolina-based 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 million customers, many of whom were elderly or disabled. Paul Miller, a disabled former photojournalist, was the original plaintiff, and a jury awarded him $275,000.

Monday's unanimous ruling by the California Supreme Court upheld a 2006 appeals court decision that reversed the trial court ruling.

James Sturdevant, a lawyer for the plaintiffs, did not immediately return a call seeking comment.

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.

The California Supreme Court said it had ruled in 1974 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 it 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.

Bank of America shares were up 25 cents, or 2.2 percent, at $11.52 in afternoon trading 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)