Saying Oakland’s air quality is at risk, lawyers for the city and environmental groups urged a federal appeals court Tuesday to stop a developer from storing coal and shipping it from a waterfront terminal.

The project won approval in May 2018 from U.S. District Judge Vince Chhabria, who ruled that Oakland officials had violated the city’s 2013 contract with developer Phil Tagami when they banned coal handling and storage within city limits in 2016 and then retroactively applied the ban to the marine terminal project. Chhabria said the city had failed to produce adequate evidence for the City Council’s findings that coal and petroleum coke operations posed “a substantial danger to people in Oakland.”

At Tuesday’s hearing before the Ninth U.S. Circuit Court of Appeals in San Francisco, Oakland’s lawyer, Stacey Leyton, said Chhabria had improperly second-guessed the City Council, which was authorized by the contract to assess potential hazards.

“The evidence showed hundreds of tons of emissions containing heavy metal would be released, which are dangerous in any amount,” Leyton saod. “Just the passing coal trains themselves (on the way to the terminal) would drive Oakland above national ambient air-quality standards.”

Oakland’s contract with Tagami “assigns the role of fact-finder to the city,” said Colin O’Brien, lawyer for the Sierra Club and San Francisco Baykeeper.

Tagami’s lawyer, Robert Feldman, countered that Chhabria had given the City Council and its experts all the deference required by law, and then “pointed out the flaws in their reasoning.”

The 2013 contract allowed Tagami’s Oakland Bulk and Oversized Terminal, or OBOT, to build a $250 million shipping terminal near the Bay Bridge toll plaza. The terminal is a key segment of a 130-acre development that Tagami’s California Capital & Investment Group has undertaken at the old city-owned Oakland Army Base. The terminal has not been built.

The contract authorized the city to impose future regulations if they were necessary for health and safety reasons. It did not ban coal, but city officials said the company had assured them that coal wouldn’t be stored or shipped at their terminal.

In 2014, however, Tagami’s shipping operator, Terminal Logistics Solutions, entered talks with four coal-mining counties in Utah. Officials of those counties promised to invest $53 million in the terminal if the company could guarantee that it would export their coal. The coal would be hauled from mines in Utah, Wyoming and elsewhere and stored at the waterfront terminal before being shipped overseas.

In support of Oakland’s 2016 ban on coal handling and storage, city officials said coal dust, which flies into the air when pieces of the mineral are jostled against one another, would be particularly hazardous for low-income neighborhoods in West Oakland, where children already suffer high rates of asthma and other illnesses.

But Chhabria said in last year’s ruling that the City Council’s findings were riddled with inaccuracies, gaps in evidence and questionable analyses, “to the point that no reliable conclusion about health or safety dangers could be drawn from it.”

For example, he said, the city failed to examine the use of railcar covers and chemicals to suppress dust emissions.

The three-judge panel at Tuesday’s hearing gave no clear indication of whether it would uphold Chhabria’s ruling.

If the city had sole authority to decide whether the project was dangerous, “doesn’t that make the contract illusory?” Judge Carlos Bea asked O’Brien, who replied that both sides had agreed on the terms.

Later, Bea noted to Feldman that Tagami’s company had agreed in the contract that the City Council could prohibit storage and shipments if it found “substantial evidence” of danger. “Why aren’t you bound by that agreement?” Bea asked.

Feldman replied that the contract was binding but the council’s evidence wasn’t substantial.

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