But one law-enforcement official, speaking on the condition of anonymity in order to discuss an open case, said that Mr. Schwartz spent several years “actively assisting” Mr. Paz and knew “exactly what kind of business was being conducted” in his buildings.

The former tenant in the Park Slope building, who spoke on the condition of anonymity because she feared retaliation by her previous landlord or his associates, said Mr. Schwartz’s response when she asked him why he tolerated having the sex trade in his building was, “They pay me good money.”

A business built on renovating ‘dumpsters’ and housing the homeless

In one of his appearances in housing court, Mr. Schwartz said that his business was built on buying buildings in distress — or what he called “dumpsters” — and turning them “into something.” His strategy depended on receiving city money to house the homeless.

“So mainly all of my real estate is put together from shelters,” he testified in 2016.

On numerous occasions, the city paid Mr. Schwartz to house the homeless in some of his buildings, court records show, including one at 880 Gates Avenue in Bedford-Stuyvesant, where the authorities said a brothel operated.

But the brothel buildings comprised only a fraction of Mr. Schwartz’s larger portfolio. Through a network of shell companies, he owns at least 48 properties worth more than a combined $87 million, city records show. The companies all can be tied back to an entity called Pacific Management, which Mr. Schwartz still runs, with a partner, Mendy Lowy, from a cramped and cluttered office on Coney Island Avenue above a Pakistani bakery. (Ms. Lowy did not respond to several phone calls seeking comment.)

Mr. Schwartz has twice ended up on the Public Advocate for the City of New York’s list of the worst landlords. Eight of Mr. Schwartz’s buildings were on the city’s watch list last year, racking up more than 500 violations for problems such as water leaks, bulging walls and inadequate light and ventilation, officials said. Court records show that Mr. Schwartz and his companies have been sent to housing court more than 150 times recently.