A state Supreme Court judge has ordered the New York Police Department to release fare evasion data at each of the more than 400 subway stations in the city, potentially capping off a yearlong legal battle over withheld statistics that civil rights advocates say shows how minority neighborhoods have been disproportionately policed.

Under a law passed in 2017, the NYPD is required to release detailed quarterly reports on fare evasion arrests and summonses broken down by age, race, gender across a range of categories at all MTA subway stations. But the department stalled its release of the data, missing several deadlines. When it finally publicized the statistics, the report was incomplete. It included data on the top 100 subway stations by quarterly arrest and summons totals but only supplied raw arrest and summons data for the top 10 subway stations.

Broader data for arrests across the city reveals a sharp racial disparity in fare evasion enforcement. From January to June of this year, 89 percent of those arrested for fare evasion were either Asian, black or Hispanic, according to NYPD data. The MTA has said that it loses approximately $215 million annually to fare beaters, and the NYPD has been engaged in a crackdown. Summonses are up significantly this year, with 34,577 having been issued from January to June. That's up nearly 80 percent compared to the same time period in 2018.

Following the NYPD's refusal to produce the full data, Council member Rory Lancman, a Queens Democrat who had sponsored the legislation, along with the Community Service Society, sued the NYPD twice. Monday’s ruling was in answer to an April lawsuit filed by Lancman and the Community Service Society that asked the court to force the NYPD to comply with a Freedom of Information Law request.

The court decision requires the NYPD to produce detailed data from October 2018 thru March 2019.

Lancman said he plans to demand that the NYPD release the statistics by the end of the month, and that he hoped that the department would go beyond the scope of the judge’s order and release all of the information for prior periods that it failed to report as well as going forward.

“A court has said this information should be disclosed to the public. The NYPD should not play games and follow only the limit of this decision,” he said, adding, “It would be offensive to expect us to to issue a FOIL request every quarter.”

The NYPD had argued that detailed information that showed a low number of arrests and summonses at specific subway stations might jeopardize public safety by attracting criminals.

In his decision, Judge Arthur Engoron called that theory “speculative at best, and improbable at worst,” one that likened the behavior of criminals to gamblers who “read the Daily Racing Form to determine where next to pick pockets and mug riders.”

How the NYPD chooses to respond will affect the fate of the initial lawsuit filed by Lancman and the Community Service Society in September 2018, in which they sued both the NYPD and Mayor Bill de Blasio for failing to comply with the law.

The city's Law Department deferred comment to a spokesperson for the NYPD who issued the following statement: “Ensuring the safety of all New Yorkers comes first, and we worked diligently to release data that satisfies the intent of the legislation while taking into account security concerns. We are working with the Law Department to review the decision and our options.”

The fare evasion data has been long awaited by John Tran, a Harlem man who was wrongly issued a summons in December for jumping a turnstile at the A,B,C,D subway station at 125th Street. Tran, who is Asian, subsequently sued the city, the NYPD and the three police officers who falsely accused him, alleging that the NYPD employs a “quota-driven and race-based policing” practice that violated his civil rights.

Questions about the policing practices at the 125th Street station were highlighted again in March, when a black Harlem man told the Daily News that he was issued a summons after he said he jumped the turnstile only after discovering that none of the MetroCard machines at the station were working. He said NYPD officers later told him they were aware of the problem.

Kathleen Linnane, an attorney representing Tran, had pressed the NYPD to produce arrest and summons data on the 125th Street subway station.

“This is exciting,” she said, “Because it's what we’ve wanted.”

UPDATE: The story has been updated to include a statement from an NYPD spokesman. It also includes a corrected description of the top 100 subway stations for which the NYPD produced data. It is the top 100 subway stations by arrest and summons totals, not by ridership. Under the law, the NYPD was to have released data for all subway stations. The NYPD does provide data for the top 100 stations by enforcement percentage, but does not provide raw arrest and summons numbers for stations ranked 11 to 100.