The Environmental Protection Agency has ignored many years of evidence of dangerous levels of lead paint in millions of Americans’ homes and must propose tighter standards within 90 days to protect children from lead exposure, a federal appeals court ruled Wednesday.

Lead-based paint was banned by federal law in 1978, but it remains on the walls of many homes built before then. It is particularly dangerous to children and has been described by the EPA in past years as “the No. 1 environmental threat in the U.S. for children ages 6 and younger.” A federal study found that 23.2 million homes had hazardous levels of lead paint in 2005-06, including 3.6 million homes with children younger than 6.

The agency set standards in 2001 for lead contamination levels in dust and soil at the homes, but has acknowledged since then that scientific research has shown the need for tougher restrictions. The American Academy of Pediatrics has said the current rules allow 50 percent of children in older homes to be exposed to potentially dangerous levels of lead.

In response to requests for new rules in 2009 by organizations that included California Communities Against Toxics and the Sierra Club, the EPA, under President Barack Obama, agreed to take action, without specifics. When the same groups went to court in August 2016, the agency said it would issue new regulations by about 2023.

That is not enough to comply with a 1992 law that was meant to reduce, and eventually eliminate, the risk of lead poisoning to children in older homes, said the Ninth U.S. Circuit Court of Appeals in San Francisco.

“Congress did not want EPA to set initial standards and then walk away,” Judge Mary Schroeder said in the 2-1 ruling. “EPA is under a clear duty to act.”

The court ordered the agency to draft new rules within 90 days and issue final regulations no more than a year later. The court said it would modify those deadlines only if the EPA provided new information showing the need for a further delay.

The rules will not require homeowners to take immediate action, but they must disclose lead-contamination information when selling or renting a home and must reduce lead to safe levels when renovating their homes.

California law goes further and requires paint companies to pay for the cost of removing lead paint from many of the older homes, according to a state appeals court ruling last month. The court ordered three paint companies to fund lead paint removal in homes built before 1951 in 10 cities and counties, including San Francisco, San Mateo and Alameda counties.

In Wednesday’s ruling, Schroeder was joined in the majority by Lawrence Piersol, a federal judge from North Dakota temporarily assigned to the appeals court. Judge N. Randy Smith dissented, arguing that federal law established only the “grand goals” of eliminating lead paint risks and did not require the EPA to change its rules.

The ruling is “a much-needed win,” said Hannah Chang, a lawyer for the environmental groups. “EPA doesn’t dispute any of the science. They realize that these standards are outdated. Now they’re forced to do something about it.”

The EPA said it was reviewing the ruling. It could ask the full appeals court for a rehearing or seek review in the Supreme Court.

“Lead exposure remains a significant health threat to children,” the EPA said in a statement. The agency said it “will continue to work diligently on a number of fronts to address issues surrounding childhood lead exposure from multiple sources,” although no details were provided.

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter:@egelko