SOUTH PORTLAND — City officials have hired a Boston law firm to help defend the city’s fledgling Clear Skies ordinance in court and they’ve set up a fund to collect donations for what could be a long and costly fight.

The City Council voted unanimously Monday night to hire a Foley Hoag, a firm that specializes in environmental law and litigation, to defend the ordinance against oil and shipping businesses that are challenging the ban as unconstitutional.

Portland Pipe Line Corp. filed a federal lawsuit against South Portland on Feb. 6, seeking to overturn the city’s ban on loading crude oil into tankers in Portland Harbor.

The council acted quickly, encouraged by several residents who spoke in favor of defending the ban, and despite opposition from other residents.

“This is the right thing to do,” said Councilor Brad Fox, noting that he was elected to the council in November, in part because he promised to support the ordinance.

It’s unclear how much the defense will cost, so the city has set up a Clear Skies Fund to raise money to fight the lawsuit. The city’s general liability insurance carrier, the Maine Municipal Association, has told city officials that the policy doesn’t cover the lawsuit.

Foley Hoag will assist the city’s corporation counsel, Jensen Baird Gardner & Henry of Portland, in fighting the lawsuit. The city’s legal budget this fiscal year is $185,000.

“This litigation may last several years,” said Sally Daggett, a lawyer with Jensen Baird.

The city has yet to receive any donations to the Clear Skies Fund, but it will accept tax-deductible contributions from individuals, organizations and others, said City Manager Jim Gailey.

The Clear Skies ordinance aims to prevent the flow of the South Portland-to-Montreal oil pipeline from being reversed to bring Canadian oil – and potentially tar sands oil – into Maine.

In the lawsuit, filed in U.S. District Court, the company alleges that the ordinance interferes with interstate trade, discriminates against Canadian interests, devalues the pipeline and infringes on areas best left to the federal government. The company is joined in challenging the ordinance by a trade association representing tug, towboat and barge operators.

The ordinance was adopted in July, eight months after South Portland voters rejected a proposal that would have allowed only the unloading of oil in South Portland. Reversing the flow of the pipeline would enable tankers and barges to take on oil from the pipeline and transport it to other ports and refineries.

Supporters of the ban said reversing the pipeline could increase the risk of spills and would require the construction of smokestacks next to Bug Light Park to burn off gases associated with loading diluted bitumen – otherwise known as tar sands oil – from the pipeline onto tankers.

Opponents of the ban said those concerns were unfounded and worried that the ban would hurt an important employer and taxpayer in the city.

Six residents spoke in favor of hiring Foley Hoag, comparing the challenge to David taking on Goliath.

“We are fighting a big enemy – big oil,” said Catherine Chapman. “It is going to cost some money to do this…but I can’t see anything more important…Bravo. Keep going. We’re right behind you.”

Two residents spoke against the expenditure, raising concerns about the unknown cost to taxpayers, some of whom opposed the Clear Skies ban.

Warren Ogden said it was “irresponsible” for the council to hire a firm without having a cost estimate, knowing how the city would pay for it or holding an election to see whether taxpayers would support the expenditure.

Portland Pipe Line executives insisted throughout the ordinance review process that it had no contracts and no plans to reverse the flow of the pipeline.

However, the lawsuit comes at a time when significant changes in energy markets are threatening the viability of the South Portland-to-Montreal pipeline. Those changes have led to steep declines in the volume of crude oil pumped through the pipeline.

Gailey said donations to the Clear Skies Fund should be made by check and mailed to: South Portland City Hall, City Manager’s Office, 25 Cottage St., South Portland, ME 04106.