The Jedi Code, known apocryphally as the Jedi's Meditation, was a set of rules and tenets in the Jedi Order, a religious order that devoted to the ways of the Force. The Code evolved over the course of centuries and applied to all members of the Order, from Jedi Initiates and Padawans, to Jedi Knights and Jedi Masters. Among the precepts of the Code was a rule forbidding a Jedi from training more than one Padawan at any given time. The Code also embodied the philosophical ideals of the Order, such as discipline, self control, a introspection, and was developed to help the Jedi maintain their devotion to the light side of the Force by rejecting the temptations of the dark side.
During the Imperial Era, few adherents of the Jedi Code remained as a result of the Great Jedi Purge that all but eradicated the Order. When the Order was rebuilt during the New Republic Era, Jedi Master Luke Skywalker trained his apprentices, including his nephew Ben Solo, to adhere to the principles of the Jedi Code.
The Jedi Code was a series of rules and tenets that governed the Jedi Order's actions and embodied its beliefs. The Code taught its followers to not give in to feelings of anger toward other lifeforms, which would help them resist fear and prevent them from falling to the dark side of the Force.
The Code forbade the Jedi from killing unarmed opponents as well as seeking revenge. Amongst other dictates, the Jedi Code forbade Jedi Knights and Jedi Masters from training more than one Padawan at a given time.
Attachment was also forbidden by the Code. Grand Master Yoda stressed that attachment led to jealousy, greed, and ultimately the fear of loss, all of which were paths to the dark side. Ahsoka Tano also regarded attachment as dangerous, and rejected Grogu as an apprentice due to the foundling's bond with the Mandalorian bounty hunter Din Djarin.
Notwithstanding the strictures against attachment, the Code emphasized compassion as an essential aspect to the Jedi way of life, teaching that all lives were precious, though outsider misunderstandings of this were not unusual. While Jedi did not marry, the Code banned neither romantic feelings nor familial love. Nevertheless, giving into personal attachment was tantamount to forsaking the way of the Jedi, the teachings of which had little to do with typical family relationships.
A Jedi such as Obi-Wan Kenobi, trained in the ways of the light side of the Force, could take comfort in the words of the mantra of the Jedi Code:
There also existed an alternate version of the Code, recited by Jedi younglings during their Initiate Trials, and by Depa Billaba during her full fitness re-assessment after waking up from her 6-month coma:
Jedi were taught to accept the inherent dark side within themselves and conquer it, and not let it conquer them. Fear of loss, anger, hate, jealousy, greed, and aggression—all of the dark side—had to be stripped from its influence over a Jedi through patience and training.
While the Jedi Code forbade possession and attachments, the Jedi were encouraged and trained to love in terms of compassion. Indeed, Jedi Master Zallah Macri, while explained the code to her apprentice Kevmo Zink, simply noted that a Jedi was "allowed to like people and things," but they could not allow those attachments to consume them. Jedi Knight Indeera Stokes stated that love, experiencing and embracing joy, affection and even grief was part of the light side, however, a Jedi couldn't be a slave of these emotions.
Attachment was the inability to accept change as the fundamental characteristic of life; to accept death as the natural part of life; the inability to let go. Feeding into fear of loss and greed, leading to jealousy, attachment was selfish, a shadow of greed and thus a path of the dark side of the Force. Therefore, attachment was forbidden for a Jedi, who had to train themselves to let go of everything they were afraid to lose; to renounce all attachments. Thus, they could be compassionate and loving and caring, but not be possessive and grabbing and holding on to things, trying to keep them frozen in time, accepting the transitional nature of life. This allowed them to love the totality of life unconditionally without selectively choosing individual life-forms to become selfishly attached to. An example of a Jedi whose attachments led to the dark side was Anakin Skywalker, who became a Sith in service to Sidious in his obsessive quest to get the power to save his wife from death.
Members of the Jedi Order considered each other their family and sometimes were truly related by blood. Jedi Masters developed strong, trusting and loving bonds with their apprentices whom they raised, being like a parent to them. However, they were not supposed to form attachments; for the greater good, they had to be able to let go of their apprentice, and to not sacrifice a thousand lives just to save one. The Jedi considered romantic feelings "natural" and as such, they did not outright prohibit them. According to Jedi Master Obi Wan Kenobi, however, they were not supposed to enter into a romantic relationship - it was essential for a Jedi Knight to make the right choice for the Order and not neglect their Jedi duties in the favor of their beloved, even if that would mean the end of the relationship.
Jedi Knight Rael Averross believed that the Jedi code permitted casual sexual relationships as long as the Jedi did not form attachments. Averross had such a relationship with Selbie, an innkeeper on Pijal, when he served as Lord Regent of that planet. His friend and fellow Jedi Qui-Gon Jinn did not agree with this belief.
The Jedi were encouraged to rely on their instincts over their mind. They held their emotions valuable but were also warned to be mindful of them, for they could cloud their judgment. A Jedi had to maintain a serene, quiet mind in order to stand on the light side instead of the dark—thus, they were able to keep the Force within them in balance.
The Jedi knew that the universe was far from static, and the way of the Force was that all life forms eventually must die. They had a strong faith in the Force and found comfort in knowing that upon dying, they, just like all things that ever lived, would be transformed into the Cosmic Force, the wellspring from which the Living Force emanated, becoming one with it. Therefore, they saw death as a natural part of life; despite being saddened by it, they were advised to remember that one day they would all pass on, and rejoice and celebrate those around them who passed away and become one with the Force, instead of grieving and missing them. The fear of losing the living to inevitable death was attachment, the shadow of greed.
The evolution of the Jedi Code spanned centuries and was driven by the Jedi Order's goal of remaining true to the light side of the Force by rejecting all paths to the dark side. The modern Jedi Code was believed to have been written by Jedi Master Odan-Urr. Believing that using the Force was dangerous to the overall universe and having fallen in love with the Padawan Kevmo Zink, Marda Ro of the Path of the Open Hand believed she would be able to convince Zink to reject the ways of the Jedi so he could be with her and join the Path. Ultimately, however, Zink was killed by the Great Leveler, but Ro blamed the Jedi for his death by claiming they had brainwashed him into the wrong ideology.
Although the Jedi Code required adherence from all members of the Jedi Order, Jedi Master Qui-Gon Jinn was better known for his efforts to follow the will of the Force than the tenets of the Code. Jinn's willingness to defy the Jedi High Council put him at odds with the Order's leadership, as well as his Padawan, Obi-Wan Kenobi, who believed that his Master would have served on the High Council if he had followed the Code. During the final years of the Galactic Republic, Jinn offered to train the Chosen One Anakin Skywalker, but the High Council rejected his proposal, citing the Code's restriction against training multiple Padawans. By the end of the Invasion of Naboo, however, the High Council permitted Kenobi to train Skywalker in place of Jinn, who was killed by the Sith apprentice Darth Maul.
Iskat Aris, who became a Jedi Knight upon the advent of the Clone Wars, struggled greatly with the Jedi Code, particularly the tenet that "there is no death, there is the Force." Observing other Jedi around her, she felt that this was a farce, merely empty words that they did not actually mean. At one point, when tasked with teaching the code to younglings, she found herself unconsciously reciting portions of the code backwards, i.e. "There is no serenity, there is passion." She claimed this to be a test for the younglings, to see if they would point it out, but it in fact reflected her own feelings.
During the Clone Wars, Republic officer Captain Wilhuff Tarkin believed that the Jedi Code prevented the Order from doing what was necessary to win the war against the Confederacy of Independent Systems. While Jedi General Obi-Wan Kenobi regarded the officer's views on the Code as simplistic, Tarkin felt that the Jedi should be relieved of their authority over the Grand Army of the Republic, a notion that Jedi Commander Ahsoka Tano disagreed with.
Shortly before the end of the Clone Wars, Anakin Skywalker was tasked by Kenobi and the other members of the Jedi High Council to spy on his friend, Supreme Chancellor Sheev Palpatine, something which Skywalker felt was against the Jedi Code.
As part of his efforts to rebuild the Jedi Order, Jedi Master Luke Skywalker trained his apprentices to practice the ways of the Jedi. Due to his unorthodox training as a Jedi, Skywalker sought to provide his disciples with a traditional path into the Order. As a Jedi, Skywalker conformed to the tenets of the Jedi Code and expected the same devotion from his pupils, including his nephew Ben Solo. Having devoted his life to the Jedi way, Skywalker abstained from romantic relationships, eschewed past friendships, and worked hard to restore the Order. Adherence to Jedi tenets brought satisfaction to his life, although Skywalker also felt a degree of guilt over the length of time that he spent away from his friends, notwithstanding his commitment to the Jedi Code's stance towards personal connections.
In 34 ABY, Rey heard the soft chanting of the Jedi Code emanating from the tree library that contained the original Jedi texts on Ahch-To. The chanting compelled her to enter the library, where she found the texts and began learning more about the history of the Jedi Order from Luke Skywalker.
The Jedi Code was first mentioned in the 1999 film Star Wars: Episode I The Phantom Menace. However, the Code's concept harkens back to early drafts for the 1980 film Star Wars: Episode V The Empire Strikes Back, in which Luke Skywalker takes the "Jedi Oath" before traveling to Cloud City in order to save his friends.
The "There is no emotion, there is peace" version of the Code first appeared in the 1987 Star Wars: The Roleplaying Game. It was there accompanied by a set of practical rules, more akin to a code of conduct, such as not acting for personal gain or trying as hard as possible to preserve life (while acknowledging that killing may at times be necessary). While the "mantra" part of the code lived on in later material, the code of conduct passed into obscurity. The "Emotion, yet peace" version of the mantra first showed up in the roleplaying game sourcebook Tales of the Jedi Companion from 1996.
In some Legends materials "attachment" was used in terms of fondness, affection, love or loving commitment, stating that the Jedi were forbidding these emotional bonds. By contrast, George Lucas explained that the Jedi were trained, allowed and expected to love people, even their enemies, the Sith, but they were not supposed to form attachments, because attachment led to the dark side of the Force. When one possessed or had some other attachment to something—be it pleasure, a person or experience—one became afraid to lose it. The fear of loss fed into greed; an attached person was selfish and unable to let go. This turned into anger, which would lead to hate, and hate would lead to suffering, mostly on the part of the one who was selfish, because then one would spend their lives being afraid rather than actually living. But compassion was caring and giving and thus it was love, but the opposite of attachment; it was everlasting joy, devoid of fear of loss and the pain of loss. Lucas said, "As long as you love other people and treat them kindly, you won't be afraid."
George Lucas, identifying himself as Buddhist Methodist or Methodist Buddhist, stated that his philosophy depicted in his movies was influenced by the fact that he was from San Francisco, the "Zen Buddhism capital of the United States." When author Tom Veitch asked Lucas for guidance about the spiritual aspect of the Jedi when developing the Legends comic series Tales of the Jedi, Lucas told him "Look to Buddha." In 2020, he indicated that the Jedi were "designed to be a Buddhist monk who happened to be very good at fighting."
- The Art of Star Wars: Visions