Robert A. McDonald, Mr. Obama’s secretary of veterans affairs at the time, supported plans to build new housing for disabled and elderly veterans and for female veterans with children, in spite of the acrimonious process getting there.

“My staff at the time said: ‘Don’t do anything with L.A. We need to win the lawsuit,’” Mr. McDonald said. “As a former military officer, I was all about running to the gunfire, not away from it.”

Many leaseholders were ejected. An operator of a parking lot on the property was convicted of bribing a veterans department official at the site. But some large tenants negotiated deals to avoid eviction. U.C.L.A.’s baseball park is still there, as are a dog park operated by the City of Los Angeles and athletic fields used by the Brentwood School. But congressional legislation forced those tenants to start providing services for veterans, like the use of fields and legal services.

The project was a huge beneficiary of city funds, local bonds and a voucher program run jointly by the Department of Housing and Urban Development and the Department of Veterans Affairs that Congress began funding more than a decade ago in response to soldiers returning home from Iraq and Afghanistan to poor economic conditions.

Another federal program has awarded millions of dollars annually to community agencies to help find short-term housing for veterans and deliver critical services to get their lives back on track. “People were skeptical of this program at first,” said Steve Berg, the vice president of the National Alliance to End Homelessness. “They thought veterans had too many problems when actually it was just a string of bad luck, like losing a job, that homelessness made worse.”

In 2017, as housing became less affordable in Los Angeles and homelessness was rising sharply, city residents agreed to an increase in the sales tax to help pay for affordable units. Low-interest loans, along with housing tax credits at the state, federal and local levels, have made veteran housing projects more attractive to developers of low-income housing.