SACRAMENTO — California paid more than $1.4 million to cover the legal costs of community groups that sued the state for diverting hundreds of millions of dollars meant to help homeowners hit by foreclosures during the last recession, documents obtained by The Chronicle show.

Representatives for Gov. Gavin Newsom and other state officials reached the settlement in November, agreeing to pay $1.4 million for attorney’s fees and $26,067 for undisclosed costs for three groups that pursued their case against the state for five years. The Chronicle obtained a copy of the settlement through a public records request.

The two sides were fighting over how California would spend its share of a nationwide settlement with five banks that had been accused of abusive lending practices linked to the economic crash of 2008. While the state tried to use the money to plug a budget hole, courts repeatedly sided with the community groups that argued the money should go to direct aid for homeowners.

The Newsom administration finally gave up the battle after losing in the state Supreme Court last year. Yet the more than $300 million that the state improperly diverted still has not been spent on its intended purpose — helping people who lost their homes to foreclosure.

California’s settlement with the National Asian American Coalition, the National Hispanic Christian Leadership Conference and the COR Community Development Corp. is in addition to $965,943 that the state spent on attorneys’ fees and costs to defend itself against the litigation, according to the governor’s office.

Faith Bautista, president and CEO of the National Asian American Coalition, signed off on the settlement. But she said it does little for her organization, a Daly City nonprofit that provides counseling and down-payment assistance for home buyers, or its clients.

“With the money they paid with their lawyers, with the money we paid with our lawyers, we could have helped so many homeowners,” Bautista said. “It’s always the lawyers who win.”

In 2012, California received $410 million through a settlement with the country’s five largest mortgage servicers — Bank of America, Wells Fargo, Citigroup, JPMorgan Chase and GMAC, now known as Ally Financial — which had used fraudulent practices to quickly foreclose on struggling homeowners. The settlement also provided $20 billion in assistance for borrowers nationwide and more than $2 billion for other states.

Sen. Kamala Harris, then the state attorney general, negotiated to put most of California’s share into services for homeowners, such as foreclosure hotlines and legal aid.

However, then-Gov. Jerry Brown and the Legislature raided $331 million from the fund to pay off housing bonds and other debts owed by state agencies, as lawmakers struggled to balance a state budget that was still in the red.

The community groups sued the state in 2014 and won rulings that California must restore the money. But Brown fought the case and, in 2018, the Legislature passed a law retroactively declaring that the settlement had been spent properly.

Newsom, who took office last year, continued to defend the money diversion until July, when the California Supreme Court declined his request to review an appellate court decision striking down the new legislation. That unanimous ruling declared the “money was unlawfully diverted from a special fund in contravention of the purposes for which that special fund was established.”

The following month, Newsom announced that the state would place the $331 million into a trust for nonprofits that assist with borrower relief in foreclosure cases and represent renters facing eviction. During a news conference, he applauded the plaintiffs for “exercising leadership and forcing the state to come to grips with its previous determination that this money should have been used to pay off the debt related to housing bonds.”

“I think this is a much better proposal,” he said, “and in that respect, they deserve an enormous amount of credit.”

Nearly six months later, the program still has not been established.

The Legislature passed a bill in the fall stating its intent to “create a trust to manage these funds,” which Newsom signed in October. In his budget proposal this month, he said his administration was “exploring, with input from stakeholders, ways to establish and manage a trust.”

Jesse Melgar, a spokesman for Newsom, said the administration expects to work with the Legislature in the coming months to produce a plan.

“The timeline for the flow of funding will depend on the legislation and time it takes to set up and manage the trust,” he wrote in an email.

Bautista said she was frustrated and “beyond anger” that, despite repeated court rulings, the state was not acting with any urgency to finally put the mortgage settlement toward its intended purpose.

“Why not? You’ve got the money there. There’s a court order to help. It’s so clear,” she said. “Sad, sad, sad. And a shame on them.”

Alexei Koseff is a San Francisco Chronicle staff writer. Email: alexei.koseff@sfchronicle.com Twitter: @akoseff