It was an unlikely partnership. But between New York’s LGBT community in the 1960s being forced to live on the outskirts of society and the Mafia’s disregard for the law, the two made a profitable, if uneasy, match.

As the gay community blossomed in New York City in the 1960s, members had few places to gather publicly. Shunned and criminalized by the broader culture, LGBT people were eager for any spot where they could safely come together. But going to a bar could be a dangerous proposition. At the time, it was still illegal to serve gay patrons alcohol, to display homosexuality in public or for two gay people to dance together. Under the guise of New York State’s liquor laws that barred “disorderly” premises, the State Liquor Authority and the New York Police Department regularly raided bars that catered to gay patrons.

Where the law saw deviance, however, the Mafia saw a golden business opportunity.

A family chart of the Vito Genovese mob family. Bettmann Archive/Getty Images

Since the days of Prohibition, when alcohol was outlawed, the mob controlled much of New York City’s nightclub business—with special expertise in its shadowy, illegal fringes. The Genovese family, one of the so-called “five families” that dominated organized crime in New York City, reigned over Manhattan’s West Side bar scene, including the Village where the LGBT community was taking root.

A member of the Genovese family, Tony Lauria, a.k.a. “Fat Tony,” purchased the Stonewall Inn in 1966 and transformed it from a bar and restaurant that attracted straight clientele into a gay bar and nightclub. Run on the cheap, Stonewall was known for being both dirty and dangerous: It operated without running water behind the bar, glasses were “cleaned” by being dunked in tubs of dirty water, and toilets regularly overflowed. The club also lacked a fire or emergency exit.

Despite its less-than-ideal conditions, Stonewall quickly became a popular destination in the gay community—even something of an institution. It was the only place where gay people could openly dance close together, and for relatively little money, drag queens (who received a bitter reception at other bars), runaways, homeless LGBT youths and others could be off the streets as long as the bar was open.

To operate its gay bars, the Mafia greased the palms of the NYPD. “Fat Tony,” for one, paid New York’s 6th Precinct approximately $1,200 a week, in exchange for the police agreeing to turn a blind eye to the “indecent conduct” occurring behind closed doors.

An NYPD officer grabs someone by their hair as another officer clubs a young man during a confrontation in Greenwich Village after a Gay Power march in New York, 1970. AP Photo

Not that the police didn’t still raid the LGBT establishments. But first they would tip off the owners, who told them the best time to come by. Raids often occurred in the early afternoon, when few customers were present, so businesses had enough time to resume normal operations by night. David Carter explains in his book Stonewall: The Riots That Sparked the Gay Revolution, that during a typical raid, bar owners would change the lights from blue to white, warning customers to stop dancing and drinking. Patrons were lined up and required to show identification; if they didn’t have any, they could be arrested. Men were hauled in for dressing in drag and women for wearing less than three pieces of traditional “feminine” clothing. Sometimes the cops even went to the extreme measure of sending female officers into the bathroom to verify people’s gender.

To get around laws that prohibited serving alcohol to LGBT patrons, many gay bars—including the Stonewall—operated ostensibly as “bottle bars,” private clubs where members would bring their own alcohol. Patrons, on entering, were asked to sign into a “membership” book, but most people entered faked names. In reality, the mob provided the liquor, leaving most bottles outside in cars or in hidden closets where they could be easily stashed during raids.

The Mob designed the operations to maximize profits—from the cheap, watered-down alcohol sold at high mark-ups to the jukebox and bootleg cigarettes. In addition, says Phillip Crawford Jr. in his book, The Mafia and the Gays, the mob also plied the gay flesh trade, with bouncers “pimping out” patrons. But while the NYPD attempted to crack down on Mafia-run prostitution in the mid 1970s, during something known as “Operation Together,” the effort was eventually shut down in 1977. Apparently, too many high-powered individuals—including Mafia members, police officers and big Hollywood names—were implicated as clients.

14 Gallery 14 Images

Some scholars have argued the infamous Stonewall riots that sparked the nationwide LGBT movement were as much a resistance against the mob’s exploitation of the gay community as they were a struggle against police harassment and discriminatory laws. Indeed, a handwritten message in chalk on a boarded-up window of the Stonewall Inn after the 1969 riots read, “Gay Prohibition Corupt$ Cop$ Feed$ Mafia.” Two of the main gay-rights organizations that came out of the riots, the Gay Activists Alliance and Gay Liberation Front, actively championed getting organized crime out of gay bars.

The Mafia’s stranglehold on New York City’s nightlife businesses took a huge hit with a series of high-profile prosecutions in the 1980s. But while the LGBT community had found it less than ideal colluding with crime lords, in some ways the mob provided them with a much-needed haven at a time when the rest of the country was still hostile and unwelcoming.

READ MORE: How Activists Plotted the First Gay Pride Parades