As bad as yesterday’s stock market rout was for Wall Street, it was even worse for Bank of America boss Brian Moynihan.

The nation’s largest lender led a sell-off of bank shares yesterday and was the biggest loser in the S&P 500 index following fresh mortgage litigation and growing concerns about its capital cushion.

The banking giant, which is already reeling from billions in mortgage-related losses and litigation, was slapped with a $10 billion lawsuit by AIG alleging that BofA committed “massive fraud” in selling soured mortgage-backed securities.

BofA plunged more than 20 percent, falling $1.66 to close at $6.51, on a day when S&P’s unprecedented downgrade of the nation’s debt sparked a massive sell-off that sent the S&P 500 tumbling 6.7 percent.

AIG’s suit, which relates to securities sold by Bank of America’s Merrill Lynch and Countrywide units, was the latest accusing the bank of deceiving investors about the quality of the securities.

BofA blasted AIG — 77 percent owned by the government after receiving billions in bailout aid — as “reckless.”

“AIG’s losses are attributable to its own reckless excesses and errors,” said a BofA spokesman. “We reject AIG’s assertions and allegations.”

Meanwhile, BofA investors are increasingly worried that Moynihan, who has held the reins at the firm for 19 months, is losing his handle on the extent of potential mortgage-linked losses.

AIG also joined the growing opposition to BofA’s sweeping $8.5 billion settlement with 22 large institutional investors, including BlackRock and Goldman Sachs.

On Friday, New York Attorney General Eric Schneiderman moved to block BofA’s settlement — a move that could force the bank to shell out billions more to settle with private investors and other entities.

Skittishness around the possibility that the Charlotte, NC, bank might have to raise more cash to shore up its balance sheet also weighed on the shares, with analysts worrying that the bank was undercapitalized.

“The resolution of mortgage issues (put-backs, RMBS sales and servicing) will take much longer and may indeed be much higher than management’s estimates, raising questions on the company’s ability to meet regulatory capital requirements in a timely manner,” said Mike Mayo, CLSA bank analyst, in a note yesterday.

Bank analyst Jefferson Harralson at Keefe Bruyette & Woods estimates that BofA may have to shell out an additional $3.5 billion on top of the $31.5 billion it has set aside for mortgage settlements.