New York City will dish out $15 million to the 22,000 people--many of whom were panhandlers-- arrested for loitering by the NYPD who used laws that were deemed unconstitutional decades ago.

The class action settlement, according to The New York Times, came after a federal judge in 2010 found the city in contempt for "obstinance and uncooperativeness" for enforcing laws that "banned loitering to panhandle or to search for a sex partner, or while in a bus or train station."

The anti-loitering law, passed in New York in 1964, was found to be in violation of the First Amendment three times by federal and state courts between 1983 and 1993 and yet, from 1983 to 2012, 22,000 people were still arrested using the statute.

"Thousands of New Yorkers were arrested and forced to defend themselves in court, and even serve time in jail, for completely legal behavior," said Katherine Rosenfeld, representing the eight plaintiffs in the case, according to The New York Daily News.

And she added, according to The Times, "All of the people who got charged under these statutes had not very much power: homeless people, gay people, marginalized people, vulnerable people."

In order for people to collect on the settlement, in payouts ranging from $1,000 to $10,000, must file official claims--a task that may be beyond many of those homeless beggars arrested on the city's streets years ago.

The eight plaintiffs named in the case, which started in 2005, will each be awarded $25,000, while the law firms which handled the case will get a a maximum $3.5 million in attorney and administrative fees, according to The Daily News.

Shockingly, prosecutors and judges also enforced the voided law. 6,000 of those 22,000 arrested were actually prosecuted in court, WNYC reports. Those that were prosecuted in this way will also get the opportunity, as part of the settlement, to clear their criminal records of loitering violations.

And what is the NYPD doing about all this? Rachel Seligman, a city attorney with the NYC Law Department, said, in a statement obtained by WNYC, "Due to NYPD's ongoing efforts and training, very, very few charges have been made under the unconstitutional loitering statutes in the last few years, and NYPD is dedicated to continuing those efforts in the future," adding "Unfortunately, as the statutes remained on the books for years after the courts declared them unconstitutional, all parts of the criminal justice system used them, including prosecutors, defense counsel and the court system, and people from all walks of life were affected. Under the circumstances, the City believed this settlement was in the best interests of all parties."