Every day in New York, working-class tenants deal with leaky pipes, cracked ceilings, and stalled elevators. But the last thing many of them need is a repair job from their landlord. That’s because repair jobs often come with a barrage of harassment, followed by an eviction notice.

Though many city apartments are under some form of rent regulation, landlords have found many creative end-runs to push out long-time tenants in order to redevelop properties into more valuable real estate at market prices. An obscure provision in New York City housing law allows landlords to deregulate rent-regulated apartments if a vacant unit reaches a certain market-rate price threshold.

But recently the City Council passed a law mandating that for several protected communities across the city, no such redevelopment be permitted without proof that the landlord has not harassed tenants in the past. Known as a Certificate of No Harassment (CONH), the measure is now being rolled out as a major new legal shield for tenants to resist and redress landlord abuses. With many profit-hungry landlords looking to cash in on the real-estate boom, tenants have long complained of being bullied and intimidated until they were driven away to make room for wealthier tenants or developers willing to pay top dollar.

Currently, a rent-stabilized apartment with a market value of about $2,700 monthly rent can be rented at full price once it is vacated. Landlords can take advantage of the mechanism by targeting tenants in distressed property, harassing them until they leave, then doing a quick renovation job and magically whipping a creaky tenement walk-up into a luxury duplex to be snatched up on Zillow. The measure has allowed more than 16,000 units to be wrested from the rent-regulated housing stock since 2015.

Under the new reforms, a developer would seek a permit from the city’s Department of Buildings to start a renovation or demolition on property in one of the special-coverage areas, but would first have to prove they had no history of harassing tenants in the past five years. The city would have the authority to investigate a landlord’s history, including interviewing tenants, and reviewing records of city housing authorities.

Historically, tenants facing unfair eviction orders or disputes over repairs have had to resort to the city’s housing courts, which are notorious for serving as another arena for bullying and legal manipulation for crooked landlords. But the CONH program shifts the burden of proof to landlords instead of tenants. Though the core protected areas are concentrated in working-class districts of Manhattan, Queens, Brooklyn and the Bronx, the program also covers other buildings citywide that have been flagged for potential harassment. CONH would also apply to properties previously flagged for a history of harassment, or distressed housing that has been placed under a order to vacate or other enforcement procedures. (This represents a major expansion from the program’s original coverage, which was limited to parts of Manhattan’s West Side and Brooklyn, and a group of smaller units known as single-room occupancy housing.)

If the city finds that the building owner has been harassing tenants, the landlord would face not just a denial of the permit but also an order to provide affordable housing by setting aside a portion of the property permanently for apartments that meet the city’s affordability requirements (based on the area’s median income).

According to Emily Goldstein of the Association for Housing and Neighborhood Development, although the program applies only when landlords seek significant alterations to a property, tying the permitting process to the landlord’s conduct is the key financial condition: “Those permits are often extremely important to their plans to increase profits. Being cut off from building permits, or being required to set aside a portion of the building as permanently affordable, represents a significant long-term profit loss, and hopefully will therefore act as a better disincentive than earlier harassment penalties.”

Though the program is still in the pilot stage, advocates hope that once it becomes part of the city’s overarching housing regulation framework, CONH will act as a broader check on landlords’ dirty tactics to push out vulnerable tenants and provide a measure of due process that has long been denied to the city’s working-class renters.

The legislation was crafted by a commission led by City Council member Brad Lander in collaboration with the Department of Housing Preservation and Development. But the initiative had been fueled by months of campaigning by the Coalition against Tenant Harassment, an alliance of housing-rights and community-advocacy groups.

In an announcement of the new legislation, Maria Cortes of the advocacy organization Make the Road New York said the CONH program “gives real voice to tenants and gives more weight to the complaints we make against our landlord.”

In recent years, gentrification and aggressive deregulation of apartments has devastated the city’s affordable-housing stock. Over the past quarter-century, according to state data, the city’s rent-stabilization system has hemorrhaged nearly 150,000 units.

Carmen Vega-Rivera, a retiree of the arts and nonprofit sectors and now veteran tenant organizer with the Community Action for Safe Apartments, has been living with a disability in her relatively low-priced Bronx apartment for years. But she says that profiteering landlords have turned it into a war zone.

“I wanted to stay in the community because I loved it and I loved everything about it. Where I’m at now is, my rent is of no value to the landlord, and I cannot get basic services and repairs.” With so many neighborhoods threatened by gentrification and rezoning that invite high-priced development into “hot” areas, Vega Rivera says that to really wield its power, tenant organizers must use the CONH program as a vehicle for grassroots activism. Through encouraging participation in hearings and landlord investigations, organizers could show fellow tenants, “Here are the tools that we have, put this tool into your toolbox, this is how it works.” Once that pressure is brought to bear, landlords—both in the protected zones and throughout the city as a whole—will start feeling the political consequences of displacement.

The city’s real-estate landscape can be savage, but the CONH could become tenants’ preemptive strike against predatory developers encircling their neighborhoods, as working-class residents struggle to keep gentrification and displacement at bay.