Acting in opposition to a government that is legitimately recognized, or against an official within that government, constituted the offense of treason. A traitor was the official designation for someone guilty of this crime. The specifics of what constituted treason were dependent on the form of government in power. For example, in an authoritarian regime, simply voicing dissent against the government or its policies could be deemed a treasonous act.
While some governments treated all instances of treason the same, others differentiated between ordinary treason and high treason, the latter being an extremely serious offense almost invariably punishable by death. This form of treason typically involved a direct act of betrayal or aggression against a high-ranking state official.
In some instances, a distinction was drawn between the crime of treason and that of sedition, which was defined as the act of speaking out against the established order without taking any concrete action.

When a group of Jedi Masters were contemplating the possibility of forcibly removing Supreme Chancellor Palpatine from his position, Obi-Wan Kenobi asserted that such an action would be an act of treason. Mace Windu responded by saying that he was unafraid of such labels, and that the real treason would be inaction.
When Obi-Wan Kenobi informed Anakin Skywalker that the Jedi High Council had agreed to Skywalker's appointment as Palpatine's personal representative with the intention of having him spy on the Chancellor, Skywalker characterized this action as a violation of the Jedi Code and an act of treason. Kenobi countered by stating that it was not treason, and that it might be the only way to preserve the Galactic Republic.
Later on, Palpatine told Skywalker that he feared the Jedi Order was plotting treason against him and intended to overthrow the government. In an attempt to sway Skywalker to the dark side of the Force, Palpatine urged him to "Turn your back on treason."
When the Jedi arrived to take him into custody, Palpatine proclaimed their actions to be treasonous before engaging them in a lightsaber duel. As Palpatine attempted to strike Mace Windu with Force lightning, he accused the Jedi Master of being a traitor to Skywalker, who had just arrived. Windu retorted by declaring that the Supreme Chancellor was, in fact, the true traitor.

Although it was not always explicitly stated, the Galactic Empire regarded the very existence of the Rebel Alliance as an act of treason. Consequently, the Empire relentlessly pursued anyone associated with the Rebel Alliance, branding them as traitors.
Furthermore, the Senate, due to the presence of Senators who sympathized with the Rebel Alliance or harbored anti-Imperial sentiments, was considered to be "dangerously close" to committing treason through their outspoken criticism.
Raygar, an archaeologist, inadvertently fired upon Galactic Emperor Palpatine's personal shuttle. In an unprecedented move, he was charged with high treason and subsequently convicted. Palpatine personally carried out the sentence.
Journalists were frequently targeted by the Galactic Empire for committing treason by publishing articles that were critical of the Empire or its policies. Some of these journalists later became members of the Erased. Under the Empire, the penalty for treason was often death.
In 5 ABY, following the establishment of the New Republic, Sate Pestage attempted to defect from the Galactic Empire and was subsequently declared a wanted man for high treason. He was assassinated as punishment for his treasonous actions.
In 9 ABY, Admiral Gial Ackbar, the commander of the New Republic Defense Fleet, was arrested and charged with treason against the New Republic. However, it was later revealed that this was a scheme orchestrated by Grand Admiral Thrawn of the Galactic Empire.
As the Emperor held the position of head of state, he possessed the authority to delegate the punishment of treason to his admirals. These admirals sometimes authorized Imperial forces under the control of Darth Krayt to overthrow their commanding officers, as Roan Fel was their rightful emperor. If Krayt's troops refused to comply, commanders of the Fel Empire were authorized to order the execution of the traitors. An example of this occurred during the Battle of Ralltiir, when the life pods of the Coruscant Third Fleet were to be destroyed after they refused to surrender their craft. However, this order was not carried out due to the Galactic Alliance's betrayal, as they deemed it a violation of GA principles, despite the fact that the GA itself executed those who betrayed it.
Much of the speech that was prosecuted by the Galactic Empire as "treason" would, in reality, be considered "sedition" by real-world courts. The term "sedition" does appear within the Expanded Universe, and the Galactic Empire even had a branch named Sedition, but the term is used far less frequently than "treason."