A federal judge has permanently prohibited Philadelphia from placing liens on rental properties for tenants' unpaid gas bills and has declared any existing liens from unpaid tenant bills "invalid, null, and void."

In the final installment of a long-running class-action lawsuit, U.S. District Judge J. Curtis Joyner issued a permanent injunction against the city and Philadelphia Gas Works over the city's practice of dunning landlords for the unpaid bills of their tenants.

The judge ordered the city to vacate outstanding liens on registered rental properties since 2009, when PGW began using a computerized lien-management system that automatically placed 200 to 300 liens a day on properties. The decision could invalidate more than $25 million in liens.

The city also was ordered to refund all money it collected from landlord liens since May, when Joyner placed a temporary injunction in place.

"This case is one of constitutional dimension with consequences that reach across a large class of landlords, which we have surmised is in excess of 40,000," the judge said in his decision, released to the public Thursday.

The decision makes permanent the injunction Joyner imposed last year, when he ruled that the city's method of placing liens on landlord properties without adequate notice was an unconstitutional taking of property. In some cases, landlords learned of the liens only after their deadbeat tenants were long gone.

Joyner declared the case a class action in November, meaning that it would apply to all landlords, not just the five property owners who brought the lawsuit in 2014.

"It's a great victory, exactly what we wanted," said John J. Grogan, who with his law partner Irv Ackelsberg filed the suit.

The city is expected to appeal the decision. Barry O'Sullivan, a spokesman for PGW, said the utility was reviewing the judge's order.

The legality of the city's practice of placing liens on properties for unpaid bills is not affected by the decision - only the method by which PGW dunned landlords for tenant bills. Unlike investor-owned utilities, PGW as a government agency has the authority to place liens on property for unpaid bills.

Liens are legal encumbrances that remain in place until they are paid off, often when the property is sold.

The lawsuit did not seek to recover damages from the city beyond the amounts listed in the liens.

"Although I do not gain monetarily from this decision, the satisfaction of winning far outweighs any financial gain," said David Wolf, the owner of Richmond Waterfront Industrial Park, one of the plaintiffs.

Wolf said the action was designed to force the city to rework its lien system to give landlords a fair warning that their tenants had become delinquent on gas bills for which the property owner might be held liable.

PGW argued that writing off the liens would cause hardship for its other customers, from whom the utility ultimately would seek to recover the money through higher rates. But the judge said the "irreparable harm" the landlords suffered outweighed the cost to PGW's customers.

Joyner said the city could resume placing liens on properties if it devised a way to notify landlords with sufficient time to resolve the dispute before it placed the liens.

He said that it "would be fairly easy and inexpensive for the city to create a method for resolving disputes between landlords and PGW," but that the city has "steadfastly insisted" it has a right to do what it is doing.

"Insofar as the city has made clear that in the absence of a direct mandate, it will make no changes to its system of liening non-customer property owners for the long unpaid debts of their tenants, we find that the entry of a permanent injunction is necessary, appropriate and in the public interest," Joyner said.

From 2009 through March 2016 , the city placed 80,000 liens for $71.8 million on properties that had different owners than the names listed on the delinquent PGW accounts, which the court used as a rough measure of rental properties. About $25.4 million is still outstanding and could potentially be affected by the judge's order.

The case is Augustin et al v. City of Philadelphia in U.S. District Court. It was filed by landlords Lea and Gerard Augustin, Thomas and Donna McSorley, and Richmond Waterfront Industrial Park.

The law firm of Langer, Grogan & Diver is counsel for the landlords. The city is represented by the Archer law firm.