Rio de Janeiro's gay community says the Games have been a victory for the city's LGBTI community.
Rio has some of the most progressive equal-opportunity laws in the world, but, despite the protections, some say homophobic violence remains rife throughout the city.
Ipanema Beach, between posts 9 and 10, is where the gay community of Rio congregates every afternoon.
The crowds build around midday as the rainbow flags beckon those in the know to a party that ends only when the sun does.
It is a place to relax, to go for a swim and, for some, like a Rio local named Sammy, a place to feel safe.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
"It's really hard to go out onto the street and be yourself, because you can be beaten just because you are being yourself, you know?"
He is speaking from experience.
A few years ago, Sammy was walking home from a gay-pride parade in Rio when he was viciously attacked by a group of men.
"Six guys were around me, and they started kicking me, and I ran away."
The scars remain.
He says the trauma of the attack has left a lasting impression on him and he still feels timid in public.
That is a paradox in a country like Brazil.
Brazil legalised same-sex marriage in 2013 and has enacted some of the most progressive legislation in the world to protect the LGBTI community.
Rio mayor Eduardo Paes maintains his city is a place without prejudice.
"We're very proud of that. I think this is a very open city, this is a very open country."
But gay-rights activists say, despite the legal protections, protection in other ways is not afforded to all people.
Julio Moreira runs an LGBTI support group called Grupo Arco-iris, which offers refuge to victims of homophobic attacks.
Many, he says, come from the poor favela, or shanty-town, communities, where police are often the second authority in charge, behind local crime syndicates.
"We have public policies, but they don't enter into favelas, for example, because there are some other kinds of power inside."
Grupo Arco-iris estimates 1,600 people have been murdered in homophobic violence since 2011.
Mr Moreira says that is one almost every day.
"We see it every day. Every day, some people have harassment or violence or they are killed."
But the Rio Olympics have provided the community with an unexpected source of pride.
With more than 40 openly gay competitors, LGBTI participation rates have reached levels never seen before at an Olympics.
Brazil's first gold medal went to judoka Rafaela Silva, an openly gay woman, while the Games also hosted two same-sex marriage proposals that stole the headlines.
Sammy, the local resident, says the victories of the LGBTI athletes at the Games are victories for the whole community.
"It's good for us, because we are there and (we) see, 'Look, it's a winner.'"

