Nobody in a roleplaying game need be what they appear to be. The town mayor could be a doppelgänger. The chief of police might be a serial killer. The king could, possibly, be a vampire.
On twists such as these are built compelling stories and adventures. The trusted NPC, perhaps the one who gave the PCs the quest in the first place, turns out to be behind it all.
But to be effective, you can't have everyone be out to get them. You need to foster an air of complacency and make them relax first, by having most of your NPCs be exactly what they appear to be. The mayor is genuinely a good guy. The police chief is completely scrupulous in rendering assistance. The king is wise and good and everyone loves him. No, really.
And it turns out the stableboy who looks after the PCs' horses is the hidden threat! A trained assassin on a mission for a wizard bent on using the PCs to release demonic evil into the world!
When this bombshell drops, the PCs can then run to the mayor, the police chief, and the king, to warn them and enlist their aid.
Only then is the correct time for them to discover the doppelgänger, the serial killer, and the vampire.
R2-D2: Hi guys, sorry I'm late. Work stuff.
GM: Right, let's start.
R2-D2: Hey Jim, did you and Annie—
GM: Let's, uh, pick up in Palpatine's office.
Padmé: I'm not there. My delegation just walked out. We're done talking.
GM: <sigh> Okay, Anakin, you're alone with Palpatine.
Anakin: Um, right.
Anakin: I don't like it, Chancellor. They know something is up.
Anakin: The Republic's secrets may not be as safe as they need to be.
Palpatine: I don't know to what you might be referring.
Anakin: Trust me. I'm on your side. I'm not sure about anyone else.
Anakin: Except Padmé, of course. Her heart's in the right place.
Anakin: But the Sith conspiracy runs deep. I may be close to unveiling the leader.
Palpatine: What? Who?
Anakin: Maybe Master Windu or... Yoda. Yoda had illicit dealings with those cloners on Kamino.
Palpatine: They are Jedi Masters! I've never known them to be less than honourable; this has become a... a witch hunt with you.
Anakin: Nobody is above corruption. Wouldn't you agree, Chancellor?
Palpatine: Get out. I won't hear any more of this poison.
R2-D2: Ouch! Should have sent Palpatine to fight Grievous.
Obi-Wan: Hey, I chopped off an arm.
R2-D2: But you're losing miserably in witty quips.