The city of South Portland has lost its bid to force Maine Municipal Association members to cover the mounting cost of defending the city’s Clear Skies ordinance against a federal lawsuit by the Portland Pipe Line Corp.

The Maine Supreme Judicial Court decided Tuesday that the city’s liability insurer, the Maine Municipal Association Property & Casualty Pool, has no duty to defend the ordinance, which blocked the pipeline company from potentially reversing its flow to bring Canadian crude to South Portland.

The city’s attorney, Sally Daggett of Jensen Baird Gardner & Henry in Portland, filed a complaint in Cumberland County Superior Court in May 2015, charging that the MMA risk pool had breached its duty by refusing to pay for the Clear Skies defense. The lawsuit has cost the city more than $1 million so far.

In February 2016, the Superior Court decided in favor of the risk pool, made up of municipalities across Maine, finding that the insurer had no duty to defend the ordinance because the pipeline company is seeking the removal of the ban rather than monetary relief or damages.

On Daggett’s appeal, the high court found instead that the risk pool’s coverage certificate specifically excludes defense of any claim that might be brought if the city takes action that reduces a property owner’s rights, including diminished use of land.

Passed by the City Council in July 2014, the Clear Skies ordinance effectively blocked the pipeline company from potentially reversing the flow of its 236-mile South Portland-to-Montreal pipeline so it couldn’t bring Canadian crude or tar sands oil here for shipment to foreign ports. The ordinance cites concerns about air pollution associated with the bulk loading of crude oil into tankers.

The company sued the city in February 2015, claiming that the ban is unconstitutional because it interferes with interstate commerce, discriminates against Canadian interests, devalues the pipeline and infringes on areas of regulation.

Since then the oil pipeline and its 23 massive storage tanks have become nearly dormant because Canada is refining heavy crude from its western provinces and North Dakota. Declining demand for foreign crude slowed tanker deliveries to the pipeline on South Portland’s waterfront to only 11 last year, according to the Maine Department of Environmental Protection.

“(The company’s) challenge to the constitutionality of the ordinance turns entirely upon the alleged impairment of (its) property rights,” the justices concluded. “Ultimately, the very injury that gets (the company) through the courthouse door nullifies any duty on the part of the pool to defend the suit.”

Daggett has declined to discuss the city’s complaint against the risk pool. MMA attorney James Bowie said the risk pool is set up to cover legal fees related to relatively predictable claims for personal injury and property damage, not lawsuits seeking declaratory judgments or injunctive relief on political decisions such as the pipeline case.