The city’s policy of giving community preference to local residents for new affordable housing reinforces racial segregation, according to a report that lawyers for the de Blasio administration fought to conceal for more than two years.

The findings, which the mayor’s office vehemently refutes—going so far as to release its own report on the housing lottery system—used municipal data to analyze whether the city’s method of handing out affordable apartments preserves the racial makeup and incomes of neighborhoods.

The report was finally released after a federal court ruling that stems from a lawsuit filed in 2015, The New York Times first reported. In it, Queens College professor Andrew Beveridge examines the city’s longstanding policy to bestow 50 percent of so-called affordable apartments in a building to those who already live in a community district, and paints a very different picture of the system than the one offered by Mayor Bill de Blasio, who is vying for the democratic presidential nomination by touting his leadership of the “fairest city in America.”

“The result of the operation of the community preference policy is a pattern that perpetuates segregation more (and allows integration less) than what would exist without the policy,” Beveridge says in his study, which was conducted on behalf of plaintiffs in a lawsuit filed by three black women who argued they did not receive a fair chance to win an affordable unit in the city’s lottery system.

Beveridge examined data from more than 7.2 million lottery applications for 10,245 affordable housing units from August 2012 to February 2017. His report looks at 168 rental lotteries and applicants’ demographic data, among other information. That information was then compared to census data for the area where affordable apartments were being offered.

In the analysis of his 68-page report, Beveridge determined that the community preference policy benefited the majority ethnic group of a neighborhood and imposed “a sorting process that would not otherwise exist and does so in a pattern that causes material disparities by race and ethnicity.”

The finding casts a shadow over one of de Blasio’s signature programs, Housing New York, which aims to create or preserve 300,000 affordable apartments by 2026. The lottery system plays a major role in how that works. In the federal lawsuit, the plaintiffs represented by the nonprofit Anti-Discrimination Center, argues that the policy hinders neighborhood integration.

Vicki Been, the city’s deputy mayor for housing and economic development who once ran the bulk of New York City’s affordable housing programs, pushed back against the suit’s claims in an interview with the Times.

“Segregation is a question of choice, and people who chose to live in a neighborhood, we believe, should be able to choose to stay in a neighborhood,” she told the Times. “We shouldn’t be telling people you have to move to some other neighborhood.”

The de Blasio administration notes that many of those who benefit from city-led housing lotteries are black and Hispanic, and also stressed that the policy is a sort of olive branch to address fears of displacement for existing residents in communities.

“Ultimately, the overwhelming message we hear in each community is that people fear displacement and want to have an opportunity to remain in their communities, and community preference plays a critical role in addressing those issues,” mayoral spokesperson Jane Meyer told Curbed.

In an 100-page rebuttal report commissioned by the city, Bernard Siskin, a statistical expert with BLDS, LLC, argued that the policy does not have a disparate impact on any racial or ethnic group and took issue with Beveridge’s methodology in three fundamental ways: That his analysis was based on subgroups, and was not conducted citywide; charges that improper comparisons were made; and that Beveridge “conflates correlation with causation, never actually demonstrating the impact of the community preference policy.”

Currently, the Department of Housing Preservation and Development is not considering the policy’s elmination or reducing the percentage of apartments earmarked for locals, the agency said.