As second-in-command, Halgar is privy to far too much sensitive information that the heroes could use against Emperor Tyranus if they ever swayed him to their side or captured and interrogated him. Thus, the Emperor keeps Halgar close to keep an eye on him and his knowledge.
Emperor Tyranus frequently physically and/or verbally abuses Halgar on a regular basis in which Halgar does plan to betray the Emperor out of revenge.
Halgar's Family was wiped out by the Emperor's evil actions in the past so Halgar took on his current name and identity and rose through the Emperor's ranks so he will have to chance to get close enough to the Emperor to take him down.
Halgar's loyalty seems to be faltering, and it looks like he's starting to think maybe he could do a better job... But before Halgar decides it's time to take matters into his own hands, Emperor Tyranus notices his increasing disloyalty and kills him.
...But once he got rid of competition and earned the Emperor's trust in the process, plans to betray him for real.
Halgar carries a freshly sharpened knife at all times that's inscribed with the words "Insert Emperor Tyranus' Shoulder Blades Here".
Emperor Tyranus laughs at the villagers for being so willing to trust him and asks how can someone be so stupid to do that. Then he talks about how incredibly trustworthy Halgar is despite how Halgar is a well known Obviously Evil case of Chronic Backstabbing Disorder.
Zig Zagged: After killing the Emperor, Halgar proves to be a much better tactician and soon has the heroes in retreat. But before he can lead the final assault, he's stabbed to death by Skullgar, his long-loyal Lieutenant who felt Halgar was getting too much of the credit.
Averted: Halgar seems to plot against the Emperor, often even talking with other minions about getting rid of him, but he never tries to overthrow him.
"A rag tag bunch of misfits fighting the evil empire is fine for our kiddie audience. The older demographic wants something more realistic. How about the second in command has been sabotaging the emperor's plans to undermine the military's confidence in him in preparation for a coup. Then we could move into a Mêlée à Trois plotline."
"We need a good way to dispose of the old villain and introduce the new one. How about an usurper?"
The work in question is part of the Transformers franchise, and features the Trope Namer himself, due to either corporate mandate or fan expectations (or both).
"Many long to be emperor. It wouldn't be odd if one of his underlings planned to usurp his power."
"Why did I even hire that backstabbing asshole?"
Invoked: The Empire encourages disloyalty in underlings, on the grounds that an underling who is strong, ambitious, and clever enough to overthrow the Emperor has every right to the throne.
The heroes know about Halgsr's ambitions, and make sure to always let him escape. After all, a house divided cannot stand...
Or, they let Emperor Tyranus know of Halgar's plans, sparking an Enemy Civil War.
Defied: Halgar proves that he's loyal to the Emperor whenever he can.
"So, you are just waiting for an opportunity to kill me and get in charge, don't you?" ("Uhm, uh - no?!")
As above, but Halgar's reply is a knife to to the chest, a sly smile, and the words "Not any more."
Conversed: "Why is everyone in the Emperor's inner circle such a backstabber? You'd think he'd want minions he could count on."
Halgar's plans to overthrow the Emperor (even if they were justified) actually help the heroes to defeat both of them in the process. Halgar then learns that, if he kept his lust for power in check and remained loyal to the Emperor, the heroes would be crushed.
Halgar manages to overthrow the Emperor and defeat the heroes, but he has no idea how to rule the empire, and so economic failures and civil wars ravage the lands, and in the end, Halgar himself is overthrown.
Halgar realize that Emperor Tyranus is mentally insane and a incompetent ruler and decide that he should be disposed. Halgar does it, takes over The Empire and, surprising, makes a truce with the heroes, which end the war. Halgar then clean up the mess Tyranus made and The Empire becomes a prospering, successful nation. Halgar also create several diplomatic and economic relationships and alliances with the other neighbour nations. The heroes, who were first suspicious at Halgar, accept that Halgar is a good leader and actually become his allies.