RIO DE JANEIRO — The city square was swarming with revelers — many of them drunk, or drunker — but Guilherme Gitsen knew he wouldn't find his target here. The area was too busy, too open. He'd have to get off the main roads. Move into the shadows. Think like one of them.

Where, if the need was insurmountable and the opportunities for relief scarce, would he go to pee?

Charged with fining public urinators during the city’s world-famous Carnival, which culminates this week, Gitsen, a member of Rio’s municipal pee squad, ducked down a darkened side street. And there, up ahead, against a truck selling ice, he found what he was looking for.

A man relieving himself in public.

Busted.

The culprit estimated he was 10 beers deep. He shrugged. What was there to say, really, except:

“I had to pee.”

Thus passed another skirmish in Brazil’s intensifying war on public urination, a frequent occurrence in a country where the people have long been more likely to invest in drinking and partying than public restrooms. Now the country’s largest cities are bolstering the ranks of inspectors like Gitsen, deploying an increasing number of portable toilets, passing increasingly strict public ordinances and writing thousands of tickets.

“Lei do xixi,” it’s called in Sao Paulo: “The pee law.”

Guilherme Gitsen, supervisor of the Zero Trash force in the Botafogo neighborhood of Rio, poses near chemical toilets.
Guilherme Gitsen, supervisor of the Zero Trash force in the Botafogo neighborhood of Rio, poses near chemical toilets. (Evgeny Makarov for The Washington Post)

The pressure to hold it is particularly acute at this time of year, when the annual bacchanal of Carnival gushes millions of people onto the streets — and when the perennial problem of public urination is most likely to make international news.

Last year, as Carnival was petering out, President Jair Bolsonaro tweeted a video of one man urinating on another during the festivities, causing the term “golden shower” to trend. And in 2016, when Rio de Janeiro was taken over by the Olympics, American swimmer Ryan Lochte found himself embroiled in an international imbroglio that included, among other absurdities, his entourage urinating into some bushes at a gas station.

Now Rio de Janeiro is pouring resources into the matter. In the last decade, it has more than tripled the number of portable toilets from 9,000 to 34,000 and dispatched squads to fine offenders, who, in local parlance, are “making xixi.”

“People are now learning the correct behavior,” said Renato Rod­rigues, an official with the city agency that oversees the efforts. “The culture is changing, and the scenario is much better now.”

Chemical toilets at Rio’s Copacabana Beach.
Chemical toilets at Rio’s Copacabana Beach. (Evgeny Makarov for The Washington Post)

Perhaps in Rio. But in other parts of the country, the issue is bigger than Carnival.

Daniel Véras Ribeiro, a professor at the Federal University of Bahia, has been conducting research at the confluence of civil engineering and urine. He says public urination is less an annoyance than a disaster waiting to happen. Urine contains low doses of ammonia, which, upon repeated application, will corrode concrete caught in the line of fire.

At soccer stadiums, many Brazilian fans, lest they miss any of the action, have historically relieved themselves on ramps and bleachers. That has led to deep structural degradation.

“If we don’t do anything about it now, the very structure of Maracana” — the famed Rio stadium — “could be destroyed,” one engineer fretted in 2000.

In 2007, an upper tier at a soccer stadium collapsed in the northern city of Salvador, killing seven people. Officials blamed the “custom of people peeing in the bleachers.”

Ribeiro says he sees the potential for similar tragedy etched into the badly deteriorated columns holding up highway overpasses and used by homeless people as bathrooms.

“The custom of peeing in public has historic reasons,” he said. “But principally, it is the result of terrible public bathroom infrastructure in Brazil, which practically doesn’t exist, and when it does, is so badly maintained that they’re practically impossible to use.”

It’s a choice BuzzFeed Brazil put to its readers last week in an online questionnaire: “Would you rather pee on the road OR in a dirty chemical bathroom?”

A narrow majority — out of 21,000 votes — went with the road.

Gitsen gives a ticket to a man he has caught urinating in public.
Gitsen gives a ticket to a man he has caught urinating in public. (Evgeny Makarov for The Washington Post)

A question the survey didn’t ask, but that criminal lawyers are mulling: Should someone be forced to pay a fine for making that decision?

Ricardo Antonio Andreucci, a lawyer who has written on the topic, said people shouldn’t pay for the state’s failure to provide basic infrastructure. “It is an abuse on the part of the police,” he said. “You can’t be writing a ticket for something that physiological.”

Tell that to Gitsen, the city worker, as he patrolled the streets on Saturday afternoon. There are children out here, he said. Families shouldn’t have to see public urination. The $140 fines, he said, help ensure civic decency. They help make this overwhelming, grimy city a little less so.

But he has no illusions about what he’s up against. “We are trying to change the culture,” he said. “This is generations upon generations upon generations. They pee on houses, on cars, wherever they can.”

Even — to Gitsen’s undying frustration — when portable toilets are within striking distance.

Chemical toilets at Rio’s Copacabana Beach.
Chemical toilets at Rio’s Copacabana Beach. (Evgeny Makarov for The Washington Post)

And so it went on Saturday afternoon, with a man in red trunks in the neighborhood of Ipanema. He ambled past the toilets and instead found a tree in the middle of a congested sidewalk to lean against, as a street party raged around him.

A Washington Post reporter waited until he had finished his business to approach. The man agreed to speak on the condition of anonymity, fearing familial and career repercussions.

“The Brazilians prefer to make xixi in the streets,” he said. “We don’t have enough bathrooms for everyone.”

Nearby, a woman was making her own bathroom right next to the entrance of a residential building, vamoosing only when the doorman, Clever Santos Chavez, chased her away.

Chavez carried a bucket of soapy water and a look of resignation.

“It is always like this,” he said, sighing. “Here, it is a bathroom.”

It was now his job to flush. He splashed down the water, and watched everything wash away.