Less than five months after San Francisco braced to say goodbye to the Stud forever, City Hall has stepped in to preserve the 50-year-old LGBT hangout, dubbing it a historically significant “Legacy Business.”

Friendly neighborhood gay bars are increasingly imperiled institutions these days, falling on hard times thanks to things like dating apps and, ironically, wider social acceptance of LGBT rights.

Plenty of old San Francisco standbys have shut their doors forever, but the possibility of a Stud closure over the summer made big headlines, partly because of its 50 year pedigree and partly because of the culprit: a rent hike from $3,800 to $9,500/month in September.

On Monday, the city’s Small Business Commission added the Stud (and 12 other local businesses, including North Beach’s Caffe Trieste and Cole Valley Hardware) to the Legacy roles.

This qualifies the Stud and its landlord for grants if the landlord extends a long lease with rent caps to the bar. The building owner doesn’t have to agree to the deal, of course, but it is better PR for the money than shutting the place down.

Drag performer Honey Mahogany advocated for the Stud at Monday’s hearing, arguing that it served as more than a mere bar and qualified as a historic and cultural institution.

Commissioners offered no arguments, cheerfully praising all 13 applicants and voting unanimously for all.

The Stud opened in 1966, noted as a SoMa gay bar that catered to a wider clientele than the surrounding leather bars.

It’s summer-closure scare ended only when a co-op composed largely of regulars stepped in to buy it.