A New Jersey law firm will get another crack at collecting on a claim of more than $3 million in unpaid legal fees, thanks to a ruling that its mortgage securing payment of those fees takes precedence over that of another creditor.

Relying on case law that reaches back to the 1860s, the Appellate Division ruled that Riker, Danzig, Scherer, Hyland & Perretti’s mortgage has priority, even though it was executed subsequent to two others by a lender, Rosenthal & Rosenthal.