The new stabilized rent of an apartment that had been illegally deregulated must be based on its entire rent history, not just the last four years, a state appellate panel said yesterday.

The ruling is the latest in a series of tenant-friendly decisions to emerge in the wake of the Court of Appeals’ 2009 ruling that apartments in buildings receiving J-51 tax benefits cannot be deregulated.