Hebriel Geneses didn't want to leave home to move to Rio de Janeiro, but his father insisted.

"At least we had a roof over our heads before," said Geneses, 16, as he sat in a busy square a block off the famous Copacabana Beach, with his belongings in plastic bags beside him. "I told my dad, 'What are we going to do if it doesn't work out?' And now here we are.' "

Geneses, his father and two younger siblings have joined thousands of others living on the streets of Rio de Janeiro. Even as officials transformed parts of this city for the 2016 Summer Olympics, its homeless population was ballooning as Brazil suffered its worst recession on record.

The number of homeless people who registered with the government tripled to 15,000 from 2013 to 2016, according to the most recent data available. But advocates say the actual number could be higher.

The increase has made Rio's infamous gap between rich and poor all the more evident, sparking outrage and conflict.

While the commercial downtown has Rio's largest homeless population, the city's wealthiest residential area, the South Zone, has also seen a significant increase. The Copacabana neighborhood in that zone has been at the center of rising tensions between the street population and affluent residents.

In September, Facebook groups for Copacabana and surrounding neighborhoods called on residents to stop giving homeless people assistance, arguing that such aid gives them an incentive to stay.

"When you see someone giving food or money, call it to attention — yell, show to everyone who is passing that person is contributing to us having more beggars in the streets of the neighborhood," one post read.

The situation continues to be discussed daily on social networks. "They are people, just like you and me, they need help, not to be treated like animals!" one Facebook user wrote recently about the homeless.

Another person responded: "We are prisoners in our own homes, losing the right to come and go safely!"

"This is the beginning of Copacabana beach becoming a slum," another user wrote about homeless people living in tents on the sand.

Business owners in the area are also complaining about the influx of homeless people, some of whom are addicts caught up in a growing crack epidemic.

"Copacabana is horrible these days," said Josecler Brunetto, 46, the owner of a burger restaurant. "People are afraid to eat at the tables I set up on the sidewalk."

Although Brazil's economy has started growing, many people are struggling to emerge from a devastating recession brought on by plunging prices for commodities and exacerbated by a massive corruption scandal that has reached the highest levels of government. The two-year slump left millions unemployed.

One of them was Geneses's father, who lost his job as a construction worker in 2015. The father eventually moved his children from a small city about 550 miles inland from Rio to Brazil's second-largest metropolitan area in search of opportunity. City officials estimate that 45 percent of the homeless population in Rio comes from other areas.

Upon reaching this city, the family spent several days sleeping at a bus station before a pastor helped Geneses and his father find work on a construction project. But six months later, the project ended and they could no longer afford rent. The family started living outdoors.

"We decided to come to Copacabana because we heard it's the best place for people to give you money and food," Hebriel Geneses explained.

But the reception has grown cooler as the population of homeless people has risen.

In October, a homeless woman named Fernanda Rodrigues dos Santos was shot dead while sleeping on the streets of Copacabana. Police arrested two suspects — a medical student and a professional martial-arts fighter.

"We live in even more fear after what happened to Fernanda," a homeless man, Luiz Phellipe dos Santos Couto, 24, said, referring to the victim. Couto began living on the streets of Copacabana when he was 13 after being expelled from his neighborhood by organized-crime gangs. He estimates that the homeless population in Copacabana has increased fivefold in recent years.

"I think residents are getting more hostile," he said, pointing out that the place he used to sleep — between two planter boxes on the sidewalk — had been filled in by potted plants.

Other homeless people have also noted property owners taking steps to discourage their presence. In August, residents of an apartment building installed what they called an irrigation system that regularly doused an area under an awning where many homeless people slept.

"If the city government doesn't resolve the problem, citizens will find a way to resolve it," Horácio Magalhaes, the president of a Copacabana neighborhood association, said in a video posted on Facebook. "Unfortunately, that's how things work in our city and neighborhood."

Rio's social assistance secretary, Pedro Fernandes, who was named to the post in October, said he came into an office "in crisis" — understaffed and with serious morale problems since employees were going months without getting paychecks, a recurring problem in Rio's state and city government offices since the financial crisis.

"People thought Rio would be the Barcelona of the 21st century," Fernandes said, comparing the Brazilian metropolis with the Spanish city that hosted the 1992 Summer Olympics.

"Instead of an Olympic legacy of infrastructure and an economic boom, unfortunately the legacy was economic hardship and an increased number of people living in the streets."

When Fernandes became secretary, eight of the city's 64 homeless shelters had been shut down, and the ones that were open were in horrible condition, he said.

"We're trying to gain back the confidence of the homeless population," Fernandes said. He has reopened five of the shelters, rehabilitated two others and opened three new hotel-style shelters. He's hoping to provide homeless people with a rental assistance subsidy usually reserved for victims of floods and is implementing a program in which the city provides bus tickets for those who wish to return home to areas outside Rio.

At one of the new hotel-style shelters, Cássio Adao, 41, made a glittery mask in preparation for upcoming carnival celebrations. He lost his job a year ago at a refinery belonging to Petrobras, the state-owned oil company ensnared in corruption scandals.

"It's frustrating," he said. "Rio had everything going for it to be a success story."