If you threw a party and a drunk guest broke a glass and urinated in the bushes, would you pull out a gun and demand money?

If this miscreant then claimed he was robbed, would you hold his friends hostage until they called him a liar and paid a hefty ransom?

No reasonable person would detain people at gunpoint for a petty misdemeanor, then demand “restitution” under circumstances that would amount to extortion in any First World country.

But this is what Brazil basically did during the Olympics to American swimmer Ryan Lochte and three teammates, after a brouhaha at a Rio de Janeiro gas station.

Lochte was railroaded by authorities and made to look like a Brian Williams-level fabricator by media, when the reality is he made a stupid mistake and told an exaggerated story. A similar situation could happen to anyone.

Lochte’s woes began after a night of partying, when he and teammates relieved themselves on the side of a gas station. Lochte also slightly damaged a small advertisement probably given free to the station.

There’s no dispute Lochte created a mess — literally and figuratively — and should’ve known better. But his crime was “truly minor,” according to Benjamin Moore, a criminal defense attorney and Brooklyn Law School professor. “[Under] Brazilian law, the biggest offense … was vandalism.”

Given that, what happened next seems heavy-handed. Security guards brandished guns, which video footage and witnesses confirm, and demanded money. The swimmers forked over $50. That sounds a lot like a robbery.

Lochte did himself no favors by publicizing the altercation and trying to sanitize the story by omitting his bad behavior. But Brazil authorities looked silly for doggedly investigating it, even though the gas station owner declined to press charges. Apparently, protecting Rio’s already bad reputation takes priority over solving murders.

Unable to interrogate Lochte, who quickly left Brazil, police grabbed his teammates. Only after the swimmers said Lochte lied and one paid an $11,000 fine, they were allowed to go. Doesn’t that sound like a shakedown?

“Pulling those kids off the plane and threatening them with prosecution … smacked of the sort of Banana Republic-ism Brazil should avoid,” Moore said. “The image was worsened when [one] basically paid a ransom to be released.”

It’s understandable if this is all news to readers. That’s because, even before all the details were known, the media already convicted Lochte. Many journalists who invariably are skeptical of American police claims whenever a criminal dies just accepted the notoriously corrupt Rio police’s version of events without hesitation. Headlines branded him an “Ugly American” and “international supervillain.” Social media piled on the media’s counter factual narrative.

“Having handled high profile cases, I’ve learned that there is often a great deal of schadenfreude when celebrities are involved … In spite of — rather because of — their notoriety, famous people do not get the benefit of the doubt,” Moore said. “Hence, an issue that is truly minor ... was amplified because of who these guys are.”

But we should sympathize. While we may never attain Lochte’s fame — or infamy — we could find ourselves in his shoes. That’s why what happened is troubling.

In contrast to our media’s overblown response, the government’s was underwhelming. U.S. officials raised no objections while another government detained, harassed and ultimately extorted Olympic heroes who hadn’t been charged with a crime. In fact, the U.S. Olympic Committee apologized to Brazil.

If a dispute arises while traveling abroad, what help can ordinary citizens expect from their government? America’s inaction speaks louder than words: Don’t count on Uncle Sam to bail you out. Instead, count your Benjamin Franklins. As USA Today observed in a story last year, “The cliche of the corrupt foreign cop spotting an American driving in a rental car, and shaking the tourist down for a bribe, endures.”

Now that the world knows the U.S. government is complicit in this, its citizens are more likely to be targeted. Consequently, American tourists might be wise to keep Carnival off their itinerary.

Grabowski is a lawyer and professor who writes on current events each month. For more info, visit markgrabowski.com.