WARNING: The following contains spoilers for Star Wars: The Rise of Skywalker, in theaters now.

The Rise of Skywalker, the ninth installment of the Star Wars saga, is already being ripped by critics and fans alike for doing a disservice to its main characters and its mythos by ignoring not only the threads that George Lucas has laid out since 1977 but also the canon developed in the Disney-era since the Mouse acquired a Galaxy far, far away. So it shouldn't be a surprise that secondary characters suffer the same inglorious fate.

Let's analyze, for instance, the ridiculous ending of General Armitage Hux, the redheaded space nazi that engineered Starkiller Base, destroyed the Hosnian System and trained an army of child soldiers since he was five years old. Yet, in Episode IX, he betrays the First Order to the Resistance because he's jealous of Kylo Ren's success... and then fails to devise an escape plan or anticipate the actions of his superiors, and whose last act is to use his face to mop the already shiny floors of a Star Destroyer.

To be fair, Armitage Hux's ruthlessness and questionable loyalty to the First Order had been teased since Domhnall Gleeson's first interviews for The Force Awakens. Gleeson described his character as someone very young, very ambitious and who'd had to kill the competition to reach his position. He was more attuned to the way Snoke's mind worked than Kylo Ren, and despite lacking charisma and gravitas was able to hold the entirety of the First Order under his command.

RELATED: The Mandalorian Introduces a New Kind of TIE Fighter

Hux's failure to protect Starkiller Base in The Force Awakens, and later the decisions that led to the loss of a Star Destroyer at the beginning of The Last Jedi, come from a combination of classic Star Wars villain hubris and the reluctance of his colleagues and subordinates to give him all the information he needs -- not because they disagree with the First Order's mandate, but because they resent his youth and position.

Yet, by the end of The Last Jedi, Hux has become Kylo Ren's greatcoat-clad stress ball, and he's furious about it. The seeds of his betrayal had already been planted in Episode VIII, so his "treason" shouldn't be a huge surprise for even the most casual Star Wars fan.

However, there has also been ancillary material reinforcing Hux's treasonous nature, which went out of  its way to set up Hux as a victim, just like Rey and Finn. The cartoon Star Wars: Resistance hinted at Hux's turn in its most recent season. In one episode, the once-confident general appears increasingly rattled, exhausted and furious, mirroring to some extent Ren's emotional outbursts.

RELATED: General Hux's Comedy In The Last Jedi Made Sense

Hux's single-issue Marvel comic Star Wars: Age of Resistance by Tom Taylor opens with Hux as a small child being horrifically abused by his father and another man. It is implied that this abuse is constant and that there is no escape from it: they are aboard a large ship, hidden somewhere in the Unknown Regions, attempting to rebuild the Empire.

We also learn that his father, Brendol Hux, the director of the Imperial Academy of Cadets, hates Armitage because he's the result of the affair he had with a kitchen worker (and let's hope it was an affair and not something much more sinister). As an adult, this abuse by his father haunts Armitage Hux in his dreams and colors his paranoid (but accurate) perception of a world in which every single adult male is out to get him. He believes that nobody will ever protect him unless they need something in return, like Gallius Rax and Rae Sloane.

We next encounter Armitage Hux in the novel Phasma by Delilah S. Dawson, both as a jaded but professionally cordial teenager and as a master of First Order internal politics. Although Hux's portrayal in Phasma is colored by the deep-seated hostility that the main characters feel for him, the one thing everyone agrees on is he is a very cunning man who has managed to survive a very hostile military environment although he's not physically imposing.

So why on Alderaan would a character like this plan to betray the only institution where he holds a modicum of power without properly planning his escape? In The Rise of Skywalker, Hux reveals his identity to Finn, Poe and Chewbacca, who have no reason to take him at his word alone, loses his temper and tells them that he only cares about Kylo Ren losing, then gives Finn a blaster so that he can shoot him in the arm. But Finn logically shoots Hux in the leg so that he can't follow them.

This leaves Hux exposed, but instead of using his wits to escape, he reports to Allegiant General Pryde (Richard E. Grant), who shoots and kills him on the spot. It is up for grabs whether Pryde kills Hux because he thinks he's a traitor, because he thinks he's incompetent or both. That's left for the audience to decide, like many other things in this frustrating movie.

RELATED: Star Wars: The Last Jedi Director Calls Catering to Fandom a Mistake

General Hux in the Star Wars sequel trilogy

So the question is... why? Why play the empathy card so heavily with Hux in ancillary material? What is the point of making the audience sympathize with the character in other mediums, only to have him killed almost at random by a newcomer, confirming the character's worst childhood nightmares?

And if the plan was to kill Hux off from his first appearance, why have him go like this? He could have gotten in one maniacal laugh before a battalion of his own stormtroopers executed him. Or he could have at least been given a glorious fiery end like Pryde, which could have been framed as poetic justice for the many people he'd sent to their deaths.

Instead, he's killed by a man who acts like the father who tormented him his entire childhood. This justifies Hux's personality while broadcasting the message that the highest crime in the Galaxy, the one that you will die for, is not committing genocide but turning against your fascist organization and betraying your superiors.

In addition, during his lifetime both Gallius Rax (Aftermath) and Kallus (Resistance) played the traitor card, a fact that Hux was privy to -- so it was not as if he didn't have any examples.

It could be argued that Hux's demise is fittingly dismissive, the ultimate insult for a character whose dreams of glory and progress were based on the destruction of planets. However, it feels very empty and unsatisfactory because Hux is dumbed down to insulting levels to make the plot point work. Up until The Rise of Skywalker, Hux's personality and career is based around the fact that he believes everyone is out to get him. That established paranoia make his actions nonsensical.

Armitage Hux had the potential to become a great villain who played opposing militaries like a fiddle, mirroring Palpatine's schemes in the realm of the Force. Instead, we got an absurd Scooby-Doo bad-guy plot that led nowhere.

Directed and co-written by J.J. Abrams, Star Wars: The Rise of Skywalker stars Daisy Ridley, Adam Driver, John Boyega, Oscar Isaac, Lupita Nyong’o, Domhnall Gleeson, Kelly Marie Tran, Joonas Suotamo, Billie Lourd, Keri Russell, Anthony Daniels, Mark Hamill, Billy Dee Williams, and Carrie Fisher, with Naomi Ackie and Richard E. Grant. The film is in theaters now.

KEEP READING: Star Wars: Disney Japan Streams Skywalker Saga Kabuki Show