Speed cameras became a cash cow for the small village of New Miami, Ohio.

The town, with a population of about 2,200, collected over $3 million in revenue from heavy-footed motorists after it installed stand-alone speed cameras along one of its major throughways, US 127. The speed cameras in New Miami, which is less than one square mile, automatically fined motorists $95 if they drove faster than 50 miles per hour.

It proved to be a lucrative venture for the village just 35 miles north of Cincinnati. Flush with cash, it raised its annual budget from roughly $1.5 million to $2.5 million in 2013.

But now, the Village of New Miami must pay back every cent of the $3 million it collected from the speed cameras, which were ruled “unconstitutional” in 2014 when drivers filed a class-action lawsuit against the village.

An Ohio judge ruled in favor of drivers, who claimed they were unfairly ticketed.

“Any collection or retention of the monies collected under the ordinance was wrongful,” Butler County Ohio Judge Michael Oster wrote in his decision last week.

The village reportedly cited almost 45,000 people and collected $1.8 million during the 15 months the cameras were tracking drivers. The village paid another $1.2 million to Optotraffic, the company that ran the speed camera program.

“We’re gratified and we’re getting closer to being able to show the drivers that we’re going to be able to put some money back into their pockets,” Mike Allen, attorney for the plaintiffs in the class-action suit told, Fox News. “Any municipality that enacts speed camera legislation can expect their budgets to swell.”

The village has reportedly spent over $100,000 in taxpayer dollars on lawyer fees defending itself in the case. A lawyer for New Miami told Fox News that it planned to appeal the decision.

“We could see the direction that this was going and we’re disappointed in the outcome,” James Englert, the village’s outside counsel, told Fox News. “We think the village has it right.”

Josh Engel, who is also representing the drivers, told Fox News that despite Englert and the village’s efforts to appeal, he is “confident” the decision will be upheld.

“Judge Oster upheld a basic constitutional principal that municipalities have to provide due process to people, and if they don’t do that, they have to refund the money,” Engel told Fox News. “The village has spent a huge amount of public money trying to defend this statute and at some point, someone in the community has to say, ‘we need to stop spending money on lawyers and just own up to our responsibilities.’”

The judge asked the attorneys representing the motorists to provide the court with a spreadsheet detailing how much their clients had to pay in tickets.

On March 3rd, Allen and Engel will ask the judge to order the immediate return of the money to the wrongfully ticketed drivers.

“This is a big victory,” Allen told Fox News, “on the way.”