The chief focus of Chhabria's criticism was a study from Bay Area-based Environmental Science Associates that was the main basis for the city's assessment of the new cargo terminal's impact.
For instance, the judge said, the study failed to assess steps the terminal developers have promised to take to limit the spread of coal dust. One of those measures involves fitting coal cars with covers, a technique that hasn't been used in the United States.
"Unable to find additional information about how well these covers would work for coal cars, ESA simply assumed they would not be used," Chhabria wrote. "This was a big mistake. The lack of existing data about the effectiveness of a new technology like rail car covers is not enough of a reason to assume them away, particularly when the developers have committed to using them."
Chhabria also said the city failed to "meaningfully" assess whether some other method -- such as applying a chemical dust suppressant to the loaded coal cars -- would be effective.
The judge cited a wide range of what he described as shortcomings in the report and other evidence considered by the city in enacting the coal ban.
The decision says these include apparent errors in some of the coal-dust emission data in the ESA report; a flawed analysis of the coal terminal's overall impact on air quality in Oakland; a failure to consider the role of regional air quality regulators in limiting emissions from the terminal; and a lack of evidence to back up concerns about fire danger, worker safety and the facility's potential contribution to global warming.
"The city was not required to compile a perfect evidentiary record; far from it," Chhabria wrote. "But the gaps and errors in this record are so numerous and serious that they render it virtually useless."
“You hardly see an opinion that is so one sided,” said David Levine, professor emeritus at UC Hastings College of the Law, after reading Chhabria's ruling.
"The judge goes in chapter and verse explaining what was wrong, and you could hardly make more mistakes, it looks like, than what was done here," Levine said.
Two environmental groups, the Sierra Club and San Francisco Baykeeper, joined the city in trying to defend the coal ban.
Erica Maharg, San Francisco Baykeeper's managing attorney, said she saw room in Chhabria's ruling for the city to try again to impose a coal ban. The judge at one point observed that "perhaps a more thorough investigation could result in a lawful determination that coal operations may be restricted at the facility."
"I think the city can go back and do a better, more robust analysis to really meet the standard, to show that this coal terminal will substantially endanger health and the environment," Maharg told KQED's Tara Siler.
UC Hastings' Levine said that while it's possible the city could try to revisit the scientific basis underlying the coal ban, he views that as unlikely.
"The problem is that what the judge did in explaining why the record was so weak, it's hard to imagine the record could be improved enough" to pass court scrutiny in the future, he said.
Mayor Schaaf issued a statement after Chhabria released his ruling and called the battle over the coal port "a fight for the health of our community."
“This is a fight for environmental justice and equity," Schaaf said. "Oakland’s most vulnerable communities have unfairly suffered the burden of pollutants and foul air for too long. We will continue to fight this battle on all fronts; not just today, but every day.”
Justin Berton, the mayor's communications director, said the city is "currently reviewing all the options, including appeal."
The ruling is the latest chapter in a dispute that began with the city's attempt to find a developer for a parcel from the old Oakland Army Base just south of the Bay Bridge Toll Plaza.
Developer Phil Tagami's Oakland Bulk and Oversize Terminal concern won the right in 2012 to develop the property as a bulk cargo facility -- one that would handle uncontainerized materials like grain, timber, cement or minerals like coal. The project is separate from the Port of Oakland.
Tagami, a former member of Oakland's port and planning commissions also known for leading the Fox Oakland and Rotunda redevelopment projects downtown, initially offered assurances that coal would not be handled at the new facility.
But word leaked in 2015 that Tagami's Oakland Bulk and Oversized Terminal and the firm created to design, build and operate the facility, Terminal Logistics Solutions, were actively planning for coal shipments from Utah. (It later emerged that Bowie Resources Partners, an energy firm that mines coal in Utah that would be shipped through Oakland, owns Terminal Logistics Solutions.)
The coal plan touched off a widely publicized dispute between Tagami and Schaaf and prompted the City Council to pass both an ordinance banning coal shipments and a resolution specifically prohibiting the fossil fuel from passing through the new bulk terminal.
Tagami sued, alleging breach of contract and saying the city's action violated the U.S. Constitution and federal law.
The Northern Alameda County branch of the Sierra Club's Bay Area chapter, one of the environmental and public health groups that had pushed for the coal ban, said it expects the legal fight over planned coal shipments to the facility to continue.
“Despite this unfortunate setback, we believe the city of Oakland has every right to protect the public health of its community, especially for the most vulnerable, by banning the handling and storage of coal at the Oakland Army Base," Luis Amezcua, chair of the branch, said in a statement.
“We are disappointed by the court’s decision to overturn Oakland’s evidence-based, common-sense ban on coal handling and storage,” said Earthjustice attorney Colin O’Brien. “We continue to stand with the city and its residents, who made the brave choice to put the health and well-being of the families and children of Oakland above the machinations of Tagami and his corporate partners.”