Ontario's top court has given the green light to a massive class action lawsuit, allowing hundreds of people alleging civil rights abuses during the 2010 G20 summit the right to sue the Toronto police.

About 1,000 people were arrested or detained during the protests in June of 2010, which saw widespread vandalism and police cars being torched. Police would later box in crowds of demonstrators at various locations across the city. Protesters from three of the locations were held in what the lawyers described as "overcrowded wire cages in inhumane conditions in a warehouse" that had been set up as a detention centre specifically for the summit.

Most of the people arrested were later released without charge.

In one especially controversial episode, hundreds of people were "kettled" at a major downtown intersection, in the rain, for several hours.

One of those people was Shervin Akhavi, who approached a group of chanting demonstrators who sitting at the intersection, and found himself surrounded by police minutes later.

He said he was handcuffed and kept standing in pouring rain for four to five hours, along with the others. People who got caught in the middle included the elderly, children, passing soccer fans, and reporters, Akhavi said.

"It was pretty surreal, confusing, and really, the atmosphere got eerie," he told VICE News. "All sorts of stuff you wouldn't believe could happen to you in downtown Toronto."

Meanwhile, "significant delays, overcrowding, and a breakdown in prisoner care occurred" at the detention centre, read the decision, released Wednesday afternoon.

"The police cannot justify the detention of a person based on information that they either did or not have, or which they did not rely upon, in ordering a person to be detained," it stated.

It's been a long legal battle for the plaintiffs in the lawsuit, which was first filed six years ago.

'It was pretty surreal, confusing, and really, the atmosphere got eerie.'

The lawsuit certification from the court, which is required for it to proceed as a class action, was refused initially, but later granted by Ontario's Divisional Court, which decided that the case should be split into two separate proceedings — one for those detained at locations across the city, and another to deal with the alleged mistreatment of those at the detention centre.

"It is important to remember that the police cannot sweep up scores of people just in the hope that one of the persons captured is a person who they believe is engaged in criminal activity," Divisional court said in their highly critical earlier ruling cited by the Appeal Court.

The court rejected the police's argument that the certification should be quashed because the conduct of individual protesters precluded them from being identified as a class. The judge accepted the Divisional Court's conclusion that people were detained without "regard for the individual characteristics or conduct of each class member."

The decision also noted that only 16 people have brought forth individual claims against the Toronto police, stemming from the events of that weekend.

"It remains apparent that most of the affected individuals are unwilling to devote the time and expense necessary to seek individual relief," the decision said. "The access to justice issue identified by the Divisional Court continues to be an important one."

In a statement, Eric Gillespie, a lawyer for the plaintiffs, noted that many of the reforms recommended by by the Office of the Independent Police Review Director hadn't been implemented, and expressed hope that the decision would help that happen.

"This important decision could lead to the disclosure of a lot of confidential police documents and tapes about what really happened, or some positive reforms about policing, or compensation to the victims, or a combination of all of those," his co-counsel Kent Elson added.

The Canadian Civil Liberties Association, an intervener in the case, tweeted that it was a "big step towards justice."

For Akhavi, who has a copy of Canada's Charter of Rights and Freedoms hanging on his wall at home, it's profoundly personal. He said his family left Iran because of persecution. He hopes the class action will result in changes to the system.