A federal judge has refused to dismiss a lawsuit against South Portland regarding its ordinance banning the export of oil through the city.

South Portland argued that the lawsuit should be dismissed on technical grounds. The city said, in part, that Portland Pipe Line Corp. did not have a legitimate complaint because it had not yet filed any plans or permit applications to use its Casco Bay terminal to export crude oil, including tar sands oil from western Canada.

However, U.S. District Judge John A. Woodcock issued a ruling Thursday denying the city’s motion to dismiss the pipeline company’s challenge and allowing the lawsuit to go forward. Woodcock did not rule on whether the ordinance should ultimately be struck down.

Woodcock wrote that the lawsuit should be allowed to move forward because Portland Pipe Line has expressed an intention to export oil through the city “and cannot do so as long as the ordinance remains in place. Other approvals may be required, but Portland Pipe Line has won these approvals in the past and should not be made to pursue them again while the question of the ordinance’s legality remains unanswered.”

The company had won city approvals years ago to convert its terminal to an export facility, although those permits have since expired or been surrendered.

Portland Pipe Line operates an underground pipeline that stretches from its terminal in South Portland to Montreal. The pipeline has historically been used to send oil to Canada, but more recently has been eyed as a way to export Canadian crude.

The company is challenging South Portland’s controversial Clear Skies ordinance, passed by the City Council in July 2014, which banned the loading of crude oil into tankers on the city’s waterfront and effectively blocked the company from reversing the flow of its South Portland-to-Montreal pipeline.

In the lawsuit, filed in February 2015, the 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 the motion to dismiss.

The Clear Skies ordinance cited concerns about air pollution associated with the bulk loading of crude oil into tankers, although the court battle has thrust the city into an international struggle over the development of Canada’s abundant tar sands. Environmentalists argue that exporting the oil would accelerate global climate change, while petroleum industry representatives have said the oil is no more damaging than other crude oil.