SOUTH PORTLAND — The cost of defending the controversial Clear Skies ordinance against a federal lawsuit by the Portland Pipe Line Corp. has crept to $748,000, and the tally is expected to reach nearly $1 million as city officials prepare for a possible trial early next year.

Meanwhile, donations to the city’s Clear Skies Legal Defense Fund have topped $100,000, with substantial contributions coming from two anonymous sources, according to the city manager’s office.

On Thursday, lawyers for the city and the pipeline company are expected to submit summary judgment motions that could allow U.S. District Judge John Woodcock Jr. to decide the case as early as February, thereby avoiding a trial. However, if any facts are in dispute, the judge could decide that all or part of the lawsuit should proceed to trial in the spring.

“My feeling is, because of the complexity of the case, it’s going to trial,” Mayor Tom Blake said Monday.

Whatever the outcome in U.S. District Court in Portland, the case will likely wind up in the U.S. Court of Appeals for the 1st Circuit in Boston, Blake said.

The Portland Pipe Line operates an underground pipeline that transports foreign crude oil from its harbor terminal in South Portland to refineries in Montreal. Essentially shut down in recent months for lack of demand, the pipeline has been eyed as a possible way to export Canadian and U.S. oil to foreign markets.

Approved by the council in July 2014, the Clear Skies ordinance banned the loading of crude oil into tankers on the city’s waterfront and effectively blocked the company from reversing the pipeline’s flow.

Since the pipeline company sued in February 2015, the city has paid legal fees to its local attorney, Sally Daggett of Jensen Baird Gardner & Henry in Portland, and to Foley Hoag, a prominent Boston law firm with environmental expertise.

In total, the city has set aside a little more than $980,000 to fight the lawsuit, including a recent transfer of $500,000 from cash reserves to the legal defense fund, a similar $200,000 transfer in 2015, $177,945 in this year’s regular legal budget and $102,205 in donations.

Recent major donations include anonymous contributions of $20,000 and $50,000, $718 from Protect South Portland and $250 from Sebago Lake Anglers, according to the city manager’s office.

In the lawsuit, the pipeline company claims that the ban is unconstitutional because it interferes with interstate trade, discriminates against Canadian interests, devalues the pipeline and infringes on areas of regulation best left to the federal government.

The city is acting “to protect the health and welfare of its residents and visitors and traditional land use authority to promote future development consistent with the comprehensive plan,” according to court documents. The Clear Skies ordinance cites concerns about air pollution associated with the bulk loading of crude oil into tankers.

Environmentalists have argued that exporting oil, especially so-called tar sands oil produced in Canada, would accelerate global climate change, while petroleum industry representatives have said the oil is no more damaging than other crude oil.

As the lawsuit moves forward, Blake said he’s concerned about the potential impact of last week’s presidential election. He noted that President-elect Donald Trump has disputed that climate change is happening, railed against efforts to stop it and promised to increase fossil fuel production and export infrastructure such as pipelines.

“Hopefully that won’t influence the judge’s decision,” Blake said, “because the majority of people in South Portland still (want to fight) climate change and support the diminished use of fossil fuels.”