SAN FRANCISCO (AP) — A California judge sided with the former chief executive of the McClatchy newspaper chain and other company officials in a lawsuit alleging they mismanaged funds by buying a rival newspaper publisher and failing to diversify investments.

The officials were obligated to keep the company's stock rather than selling it off to invest elsewhere, San Francisco Superior Court Judge Richard Ulmer said in a ruling released Tuesday. The judge also said acquiring the Knight Ridder newspaper chain may have allowed McClatchy to survive the Great Recession.

The decision came in a lawsuit by Carlos McClatchy, a beneficiary of a trust fund set up by Eleanor McClatchy, granddaughter of the company's founder, James McClatchy.

The company owns the Sacramento Bee and more than two dozen other newspapers across the country.

The value of the trust fund plummeted after McClatchy bought Knight Ridder for $4.5 billion in 2006. Carlos McClatchy and other beneficiaries stopped receiving dividends that had previously amounted to millions of dollars, and he sued in 2012.

The lawsuit named Gary Pruitt, McClatchy CEO during the acquisition, and other trustees. Pruitt is now CEO of The Associated Press.

Lauren Easton, a spokeswoman for The Associated Press, declined further comment on Pruitt's behalf.

Mark Mosley, an attorney for Carlos McClatchy, did not immediately return a telephone message.

The judge said the granddaughter of the company's founder wanted the newspaper to remain under family control, so the trustees' main duty was to keep the stock "even against the conventional wisdom that assets should be diversified to spread risk."

The Great Recession and a general decline in print journalism sent all newspaper stocks plummeting, Ulmer said, so Carlos McClatchy did not prove that the trust would have done better without the Knight Ridder acquisition.

Ulmer's ruling is tentative, but such decisions usually become final.