RIO DE JANEIRO (Reuters) - When an angry crowd of Brazilians jeered U.S. Olympic gold medal swimmers Gunnar Bentz and Jack Conger, calling them 'liars' and giving one of them a tug on the ear, the young Americans looked shocked by the ferocity of their reaction.
What they appeared not to realize was that a fabricated story about how they and two team mates had been robbed at gunpoint - allegedly told to cover up an act of vandalism at a Rio gas station - hit a raw nerve in this South American nation.
Brazilians are deeply proud of their country - its infectious music, sun-kissed beaches, five World Cup victories and its status as a regional heavyweight - but are acutely aware of its problems: deep-rooted corruption, poverty and the crime that stalks the slums of its megacities, like Rio de Janeiro.
Brazil looks northward to the United States - like itself, a big country built on successive waves of immigration - with a mixture of respect, admiration, envy and resentment.
The complicated relationship has led to episodes - some minor, others deadly - involving Americans flaunting Brazilian law to the ire of those living here. The swimmers' scandal neatly fits Brazil's stereotypical view of "Ugly Americans".
"Brazil is a country that already has an inferiority complex when it comes to the United States," said Esther Solano, a sociologist at the Federal University of Sao Paulo who was in Rio for the Games.
"So people here feel vulnerable and angry when Americans come down here and act like they can do whatever they want, with no respect for rules or regard for the locals."
In 2009, when Brazil was chosen to host the Games, the economy was booming. The then president, Luiz Inacio Lula da Silva, said it showed Brazil had become a "first-class" country.
But as the Games finally arrived, preparations were immersed in a corruption scandal over infrastructure and criticism over failures to clean up the raw sewage pouring into Guanabara bay.
The two weeks of competition were overshadowed by armed robberies of foreign government ministers, athletes and tourists, as well as long queues at stadiums and lack of food.
The American swimmers' allegations appeared to be the final humiliation.
When their fabrication was uncovered, the immediate reaction of many here was "imagine what would happen to a Brazilian if they did that in the U.S.?". It was a question posted by legions of Brazilians on social media in recent days.
"The impression is that they arrived thinking this was a country without law and that they could do whatever they wanted and get away with it," said Marcelo Vieira, 33, in the Olympic Park.
Yet Brazilians also showed their playful side. Memes involving gold medal swimmer Ryan Lochte, accused by police of being the "protagonist" of the vandalism and ensuing lie, flooded Facebook feeds and Twitter, many depicting him as fiction's most famous liar, Pinocchio.
"Those of us living in Rio are used to gunfire, assaults, with everything that is bad," said Paulo Henrique Cunha, a 73-year-old accountant. "But to have these gringos show up and invent this story they were robbed? Ah, that's just too much."
The Brazilian government has never backed down from taking on Washington, from trade complaints to visa policy.
Brazil requires American tourists to have visas and that they cost the same as Brazilians pay to visit the United States
In 2004, Brazil implemented a policy of fingerprinting and photographing American tourists on arrival, in response to the United States doing the same for all foreigners entering America after the Sept. 11 attacks.
A few weeks after Brazil's policy took effect, an American Airlines pilot was arrested at Rio's airport because he made an obscene gesture with his middle finger while being photographed.
The photo of the pilot, Dale Hirsch, was printed above the fold in Rio's main O Globo newspaper - and was widely perceived as the embodiment of American arrogance.
The pilot was freed after paying a fine of $13,000 to avoid the possibility of facing two years in prison for showing "contempt for authorities" - a crime in Brazil.
On Friday, the swimmer Lochte issued an apology on his Twitter account, but it did little to quell the anger.
It was blasted on social media by Brazilians and Americans alike as a lukewarm, half-hearted mea culpa, doubly so as it contained a line about it being "traumatic" to be out partying in a foreign country where one does not speak the language.
"Medals are for honor," one person wrote on Twitter directly responding to Lochte's post, referring to the 12 he has won at four Olympics. "Lochte has none."
Additional reporting by Paulo Prada, Caio Saad, Eduardo Simoes, Anthony Boadle and Clive McKeef; Writing by Daniel Flynn and Brad Brooks