Anyone in the third world knows that the biggest thieves are usually the police. They’re underpaid for one thing, which makes angling for baksheesh a necessity if they’re to support a family.
But more than that, men with power and guns are really just another kind of mafia. Without institutionalised values of law and order and an efficient organisation to monitor them, the police have pretty much carte blanche to do what the hell they feel like. Police chiefs across the third world fill up bank accounts with wads of notes extorted from businesses and the general public and their colleague would be highly suspicious of them if they didn’t.
Whereas few police in poor countries will worry themselves too much about the law, they usually prefer to actually catch the traveler doing something before they extort all they can out of them. So whereas they could just plant a bit of dope on you (and frequently do), they prefer to bust people who are actually smoking. So keep ashtrays empty and hide your stash somewhere very private.
Travelers have fallen asleep drunk by the side of the road in Bangkok only to be awoken by Thai police who escorted them to the nearest ATM to take out the maximum. They hadn’t broken any crime but they’d behaved in a way that made them seem low enough that they could be exploited without any comeback.
Always be polite to police. Don’t be obsequious but if you play the part of a polite, upright citizen it’s harder for them to characterise you as a bum who deserves what he gets. Plus, getting uppity means the police lose face and in some countries they’ll make you pay dearly for that. Read about foreigners in Thai jails to get the message.
If you’re traveling somewhere without the right permits or where the officials are known to exploit travelers, there’s no harm in getting some letters printed out with impressive letterheads stating that you’re in the employ of the UN or suchlike. You can steal the logos from the internet and even customise them a bit in Photoshop. There’s nothing like bits of paper with letterheads and stamps to intimidate an official.