When “Strawberry” was ejected from his student digs in Denver, Colorado, following a rental dispute, he headed to San Francisco thinking it would provide a sanctuary for a young gay man.

Not so. After six months of living on the streets he had lost the shirt on his back – literally. Identified as an easy target he was chased, beaten and robbed of the backpack containing all his worldly goods. “He grabbed me by the hair, threw me to the ground and started dragging me,” he said of his attacker. “My shirt was ripped off and I got a black eye and a bloody nose,” he said. “San Francisco is not the gay-friendly mecca that they say it is.”

Thanks to the equality rights work of pioneers such as the politician and activist Harvey Milk, San Francisco has a reputation as the gay capital of the world. But as the city recovers from its 43rd gay Pride festival at the weekend, attended by more than 1.5 million people, it must confront an uncomfortable issue. The streets through which about 200 colourful parades – from drag queens to the motorcycle-riding Dykes on Bikes – travelled, are also home to increasing numbers of gay homeless people, many of whom are exceptionally vulnerable to prejudice and violence.

Download the new Independent Premium app Sharing the full story, not just the headlines

Research produced by the Human Services Agency of San Francisco (SF-HSA) has revealed that 29 per cent of the city’s homeless population are from the lesbian, gay, bisexual and transgender (LGBT) community. “Strawberry” is now living in a shelter but says his sexuality places him at risk.

“I feel that eyes are on me and they’re watching every move I make. Even in the shelter I’m confronted with being gay – it’s a really difficult situation.”

Of the 6,436 people the SF-HSA counted sleeping rough in the city, more than half of those do not stay in shelters. Earlier this month, the city authorities finally began steps to set up San Francisco’s first shelter for LGBT homeless, large numbers of whom have mental health issues. Some of San Francisco’s gay rough sleepers are young people from other parts of America or the world who have fled violence and discrimination at home in search of safety in San Francisco. Others are elderly survivors of the worst ravages of the Aids epidemic who now find themselves unable to cope financially in a city where rents have been driven sky high by gentrification and the booming economy of nearby Silicon Valley. They end up living in doorways and parking lots.

Against the backdrop of the San Francisco City Hall cupola, hundreds line up each Tuesday afternoon in the United Nations Plaza for free food handouts from volunteers. For several blocks in all directions from the city hall, tourists find themselves stepping over prone bodies on the pavement.

The San Francisco Bay Area, including Silicon Valley, is home to an estimated 220,000 millionaires, not to mention Facebook founder Mark Zuckerberg, Google founders Sergey Brin and Larry Page, Ebay founder Pierre Omidyar, investor Charles Schwab and Star Wars creator George Lucas. It is a shock to visitors to find that a city of stunning natural and architectural beauty, famed for its tolerance and future thinkers and flooded with internet wealth, should also be home to such chronic poverty.

The number of people in the Valley reliant on food stamps (federal financial assistance to low-income families to help them buy food) reached a 10-year high this year, and the number of homeless people has grown by 20 per cent since 2011.

At the Coalition on Homelessness in the Tenderloin district, a steady stream of mostly elderly people arrive to collect copies of Street Sheet, a newspaper which they sell for donations. In the surrounding streets, hotel staff hose down the streets. Shops display signs warning “No Loitering”.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

Lisa Marie Alatorre, the coalition’s human rights organiser, said attempts to establish a gay homeless shelter had been going on for a decade and she was uncertain that the chosen site in the Mission district would open.

She estimated that more than half of the city’s young homeless population are from the LGBT community, many of whom head to the Haight district, epicentre of Sixties alternative living. “I imagine they are hoping to find people who look like them,” she told The Independent. “Instead what they find is a ton of discrimination. The Haight is no longer what it was. A bunch of people have moved into a cool neighbourhood and made it a mainstream, yuppie, business space. They don’t want to see poverty and homelessness, so there’s a lot of police presence and harassment.”

Baby boomers drawn to San Francisco’s counter-culture two generations ago often worked in the hippie economy and now find they have limited entitlement to social security in a city with a high cost of living. Lack of family support is common among those who pulled up their roots and especially acute among the LGBT homeless.

While Ms Alatorre acknowledged that San Francisco remained a “wonderful city” if “you are an employed, white gay man”, she said many other LGBT groups suffered discrimination in the jobs market.

Gay homeless people often required specialist medical care, “particularly those who are HIV positive”, she said. “There’s still a ton of homophobia and transphobia in the shelters. It’s coming from the staff – their levels of compassion get burned out.”

The lack of support from the big internet companies in Silicon Valley is a bone of contention among homeless organisations. “They have no desire to be accountable to the ways that their presence is negatively impacting on San Francisco,” said Ms Alatorre.

“They are driving up the rents, they’re increasing the police presence because they’re afraid of homeless people, they are creating wealth disparity gaps and they’re taking political power. They have their own fleets of transportation and that’s taking money from the public system and adding to pollution. And the city is unwilling to [challenge this] because the wealthiest in San Francisco are really benefiting.”

The city of San Francisco is taking steps to help the city’s homeless. Bevan Dufty, director of HOPE (Housing Opportunity, Partnerships and Engagement), is the city’s homelessness tsar.

Earlier this month, when a homeless encampment under the Interstate 280 highway was cleared by city officials, he promised the residents would be given access to better support services. “Everyone’s tired of just pushing people around – the outreach teams, the police, the homeless,” he said. “So we’re trying something new, and it’s about getting people on the right path.”

San Francisco has its own homelessness czar, Bevan Dufty, who said he hoped that proposals for the city’s first LGBT specific shelter would go before the Planning Commission on 15 August. “As much as we work on staff training and creating safe environments for all shelter residents, there has been concern that some LGBT individuals are reluctant to use shelters,” he said.

“We are excited to expand our shelter capacity with a specific focus on LGBT homelessness. We hope that this important facility will also give us experience and tools to ensure that all of our shelters provide welcoming environments for LGBT individuals.”

On the streets

6,436: People are homeless in San Francisco, according to the city’s Human Services Agency

29: Per cent of those sleeping rough in the city are LGBT

1.5m: People attended the city’s 43rd Gay Pride march at the weekend