SAN FRANCISCO — Three companies must pay $1.1 billion to clean up lead paint on older homes around the state, a Santa Clara County judge ruled Monday.

After a 13-year legal battle, Judge James Kleinberg sided with a group of municipalities and ordered that defendants ConAgra Grocery Products, NL Industries Inc. and the Sherwin-Williams Company fund a plan to remove remnants of the toxin applied before lead was banned in 1978. The judge found the firms’ decades-long manufacture or promotion of white lead paint for interior use had created a public nuisance.