Texas cities may not have the authority to impose charges on consumers for single-use plastic or paper bags, according to an attorney general’s opinion issued Friday.

But outright bans on such bags appear to be legal, at least in most circumstances, the opinion said.

Dallas City Council member Dwaine Caraway first proposed banning disposable shopping bags in the city more than a year ago, saying they too often end up as litter. In March, the City Council instead voted to impose a 5-cent charge for every single-use bag carried out of a retail establishment. The fee is to take effect Jan. 1.

A month before the council vote, state Rep. Dan Flynn, a Republican from Van, had sought an attorney general’s opinion on the legality of bag bans and fees. Flynn expressed concern that such measures were “in contravention of state law,” specifically a section of the Health and Safety Code dealing with solid waste disposal.

The opinion from Attorney General Greg Abbott said the courts would “likely conclude that a city ordinance prohibiting or restricting single-use plastic bags is prohibited” only if the ordinance had been adopted “for solid waste management purposes.” An attorney general’s opinion is not legally binding.

The Dallas ordinance says the nickel-a-bag fee is “in the best interests of the health, safety, and welfare of the residents of the city” and its purpose is “to protect the environment.” Abbott said the courts would have to interpret a city’s intent in enacting such an ordinance.

But he said that in his view, a court “would likely conclude” that cities are prohibited from assessing fees on the sale or use of single-use plastic bags. The opinion refers to a section of the state health code that bars local governments from assessing “a fee or deposit on the sale or use of a container or package.”