Baltimore’s top prosecutor on Friday didn’t just charge police officers with murder and assault in the death of Freddie Gray. She also said the arrest that led to Gray’s death was itself illegal.

Claims of wrongful arrests have a long history in Baltimore. Legal advocacy groups have argued for years that the Baltimore Police Department routinely arrests citizens without cause, many of them young black men like Gray. And they have cited the city’s own data to back up those claims.

In a news conference on Friday, Baltimore State’s Attorney Marilyn Mosby said Gray ran from officers after they made eye contact with him — a flight that wasn’t itself illegal — and that the knife that Gray was carrying was “not a switchblade and was lawful under Maryland law.” Officers, she said, “failed to establish probable cause as no crime had been committed by Mr. Gray.”

The police department didn’t immediately return a call seeking comment, but in a statement Friday, police union President Gene Ryan called the charges a “rush to judgment” and said he expected the officers to be found innocent.

Whatever happens in the case, Gray’s arrest fits the pattern cited in a 2006 lawsuit that accused the Baltimore police of arresting thousands of people on minor or even made-up charges, then releasing them before the police had to present the case to a judge. The suit was filed by the NAACP and the American Civil Liberties Union.

According to data from the state’s attorney’s office cited in the suit, in 2005 the Baltimore Police Department arrested 76,497 people without warrants and released a third of them “prior to any involvement by a defense attorney or any decision by a court commissioner or judge.” Forty-three percent of those arrests were for minor crimes that rely heavily on officers’ discretion, such as loitering, disorderly conduct and disturbing the peace.

“Thus,” the suit claimed, “prosecutors indicated that they could not prove charges against those persons arrested for often vague ‘quality of life’ offenses in 2005, which amounted to nearly 15 percent of the persons arrested without a warrant during that year.”

The suit didn’t compare Baltimore’s arrest statistics to those in other cities, and comparable data isn’t readily available. But David Rocah, a senior staff attorney for the ACLU in Maryland, called the numbers “staggering” and “unmatched by any other city that I know of.”

The city settled the suit in 2010 and agreed to a range of reforms including increased training, new data collection and the appointment of an independent auditor. But in 2012, the auditor found that the city wasn’t fully complying with that settlement. The auditor reviewed a random sample of more than a thousand “quality of life” arrests and found that in 21 percent of cases, information wasn’t available because the department had released the arrestees without charge and deleted the records. In 17 percent of the remaining cases, officers failed to identify probable cause or failed to justify making an arrest instead of issuing a citation or warning as required by the settlement.

The NAACP and ACLU used data to help make their case, but they also argued that the police department’s use of data helped create the problem in the first place. The suit said that the city, under then-mayor (and now presidential candidate) Martin O’Malley, graded officers on the number of arrests they made, regardless of whether those arrests were justified.

“These perverse incentives are unavoidable because, under the ‘performance evaluation system,’ all arrests are counted,” the suit claimed, “even those made with no basis for probable cause.”

O’Malley has defended his record. At the time of the settlement, O’Malley said there was “never, ever a policy that asked police officers to go beyond the Constitution or engage in illegal arrests,” according to the Baltimore Sun. In an email on Saturday, a spokeswoman for O’Malley pointed to statistics showing that during his time as mayor, fatal and non-fatal police shootings fell, minority hiring in the department rose and complaints of misconduct declined. Violent crime, meanwhile, fell by more than in any other large city in the country, according to FBI data.

Almost none of Baltimore’s leaders at the time of the suit are still in power, and local advocates say they’ve seen some signs of change. The number of arrests has fallen sharply, from more than 100,000 in 2005 to less than 40,000 last year, as crime has generally continued to decline. But Paul DeWolfe, Maryland’s state public defender, said the protests following Gray’s death show the city hasn’t restored trust between residents and their police force.

“The legacy of that — the rounding up of people, detaining them and ultimately dismissing the charges — is part of the root cause of the frustration that the citizens of Baltimore feel toward the police department,” DeWolfe said.