The University of British Columbia has been ordered to pay back more than $4 million in parking fines collected over the past 20 years after a judge ruled the university wasn't entitled to take the money.

Daniel Barbour initiated the class action lawsuit against UBC in 2005, after his car was towed, despite the fact it was legally parked on campus at the time.

UBC parking enforcement towed the car because records indicated Barbour had four previous unpaid parking tickets worth $200.

But in the lawsuit, Barbour argued that while UBC does have the right to charge for parking and to regulate parking, the university does not have the authority to collect fines related to parking, or to tow a legally parked vehicle for a past offence.

A judge agreed, and ruled on Tuesday that UBC must compensate members of the class action lawsuit who have paid parking fines, towing fees, and administrative charges related to parking since 1990 worth more than $4 million.

UBC retains the right to tow vehicles that are parked illegally, and has said it intends to appeal the ruling.

The process by which the public will be paid back the fines has yet to be determined, but Barbour's legal representatives, Camp Fiorante Matthews, plans to post information on their website.