Every dog has it’s day, and for Dexter, the lovable pug at the center of a bitter $40,000 custody battle, that day was Monday.

Dexter’s been caught in the middle of nearly 3-year legal dogfight ever since his owners Eric Dare and Doreen Houseman ended their 13-year relationship. The dueling exes have each spent more than $20,000 in attorney’s fees and changed New Jersey law in the process.

Dare, a 36-year-old cop, and Houseman, a 35-year-old customer service manager, originally agreed to share custody of Dexter when they broke off their engagement in 2006. But things turned sour when Houseman started dating again and Dare refused to let her see the dog.

After battling it out in court Superior Court Judge John Tomasello ruled Monday that the former couple must share the dog, who will alternate, every five weeks, between the Williamstown, Gloucester County, homes of Houseman and Dare.

Houseman told the Philadelphia Enquirer that she was “very happy” with the ruling and said she can’t wait to give the dog “a lot of hugs and kisses” when she sees him again on Friday.

Dare said he may consider an appeal. “I’ve had him for six years now and never thought it would come to this,” he told the Philadelphia Enquirer.