Richmond City Council has voted to ban coal shipments out of a private port despite threats from the port owners that they would sue to block the ban, costing the city millions.

The ordinance gives businesses three years to phase out coal and petroleum coke, a byproduct of oil refining. The legislation targets a port operated by Levin-Richmond Terminal Corp., which last year loaded almost 1 million metric tons of the fuel bound for Japan and South Korea.

The council’s decision Tuesday came nearly a month after Mayor Tom Butt delayed the vote in hopes of coming to an agreement with port owners.

“I wanted to have an opportunity to come to an agreement with Levin,” Butt told The Chronicle on Tuesday. “We were unable to do that.”

After “a lot of meetings,” Butt said the city and port couldn’t agree on the timeline to phase out use of coal at the port and whether petroleum coke would be included in the ordinance. Butt declined to give details.

The Levin-Richmond Terminal is one of just four ports on the West Coast that still ships coal, after Oakland banned the product at its port, a move that faces legal challenges. In 2018, a federal judge ruled that Oakland could not ban the storage of coal. The city is appealing the judge’s decision.

Environmentalists have argued that dust from coal harms locals’ health, in addition to coal’s impact on climate change. On Tuesday, dozens of people at the meeting cheered after the council took a vote.

Last month, Gary Levin, president and CEO of the Levin-Richmond Terminal, sent a letter to the Richmond City Council and said transporting petroleum coke and coal is a majority of the port’s business. He warned that the ordinance would put the terminal out of business.

Levin-Richmond wasn’t the only entity that threatened litigation over the ban.

Coal mined in Utah by Wolverine Fuels is shipped to the Levin-Richmond Terminal, where it is stored before being exported to Japan. Wolverine Fuels owns and operates three coal mines in Utah and produces nearly 11 million tons of high-heat-content, low-sulfur thermal coal.

Wolverine’s general counsel, Brian Settles, also sent a letter to the City Council last month that said the company will “have no alternative but to pursue judicial remedies in litigation” if the ordinance passes.

Sarah Ravani is a San Francisco Chronicle staff writer. Email: sravani@sfchronicle.com Twitter: @SarRavani