In the year 34 ABY, amidst the ongoing war between the First Order and the Resistance, the First Order initiated the Attack on Ryloth upon discovering the Resistance's hidden base located on the planet of Ryloth.
Seeking assistance, General Leia Organa reached out to her long-time friend, Ambassador Yendor of Ryloth. As a result, the Resistance gained permission to establish a base within a cave base managed by the Ryloth Defense Authority. However, the First Order's arrival in Lessu, Ryloth's capital, led to a betrayal from within. During the ensuing conflict, at least one pilot and Yendor's daughter, Hahnee Brethen, tragically died. After fighting alongside Rey, Organa delivered the devastating news of Hahnee's passing to Yendor. Initially intending to sacrifice himself while operating a cannon, Yendor, upon learning of the Resistance pilot's demise through Organa, commandeered the fallen pilot's X-wing starfighter. Following the Resistance's escape from Ryloth, Commander Poe Dameron expressed his belief that the Resistance was vulnerable wherever they congregated.
The Resistance, having suffered significant losses in the Battle of Oetchi and the Battle of Crait, saw the majority of its forces decimated. However, its leader, General Leia Organa, along with several other members, survived these engagements and journeyed aboard the Millennium Falcon. Separately, at least three other Resistance cells, Team Colossus, Black Squadron, and Inferno Squad, managed to survive by being elsewhere. Aboard the Falcon, Organa determined that the Outer Rim world of Ryloth could provide a safe haven for the starship. While Lieutenant Kaydel Ko Connix initially speculated about the presence of an old rebel stronghold, Organa clarified that their destination was chosen because of a trusted ally and friend, Ambassador Yendor, whose assistance she hoped to secure. Despite the Falcon's low fuel reserves, they successfully made the jump to lightspeed and arrived near the planet. Upon being contacted by Lessu command, Rey, a Jedi apprentice and a recent addition to the Resistance, falsely claimed that the Falcon was transporting medical supplies destined for the southern region, although control of the operation was then transferred to the Ryloth Defense Authority ("RDA").

RDA One, piloted by Hahnee Brethen, Yendor's daughter, guided the Falcon to a Ryloth Defense Authority base constructed within a cave. Once inside, Charth Brethen informed the Resistance that their decision to help put them at risk of joining the war, a decision made by Yendor. Following a meal for the Falcon crew, Organa, Rey, and C-3PO were escorted to Yendor. While he expressed his desire to keep Ryloth out of the conflict, Organa assured him that they only sought shelter, foodstuff, and communication access, revealing the limited number of ships they had remaining. Acknowledging the likely opposition from Chancellor Drelomon and General Ishel, and the potential for a First Order attack if their actions were discovered, Yendor ultimately believed that aiding the Resistance refugees was the morally correct course of action. However, sometime after he agreed, the First Order arrived in the capital city of [Lessu](/article/lessu_city] for what appeared to be unrelated reasons, and they gave the Ryloth shipping guild 5 standard days to tithe to them before the shipping lanes were blockaded. Despite having less time to stage a mission out of the planet and Yendor fearing that Drelomon could betray the Resistance, Organa stuck to the plan of having their other ships arrive.
Organa's limited reinforcements, consisting of Commander Poe Dameron piloting a Hutt's starfighter, Black Squadron, Inferno Squad, and the individuals gathered by these groups, successfully arrived. After intervening in a dispute between pilot Pacer Agoyo and former Imperial officer Teza Nasz, the Resistance convened in Yendor's library, which had been repurposed as their war room, to strategize their next move. They decided to divide their forces, with Shriv Suurgav leading a group to Bracca to acquire starships, Corellian Team One traveling to Corellia to attend an auction featuring a list of First Order subversives and prisoners, and Corellian Team Two also heading to the planet to rescue prisoners held in Coronet City. Following the commencement of these missions, Rey inquired about their progress, driven by an inexplicable feeling she experienced through the Force. Despite discussing the crews' advancements, Rey's unease persisted, leading her to realize that the First Order had arrived.
After metal doors sealed the windows, Yendor issued the order to sound the alarm, coinciding with the activation of a proximity alarm. Hahnee was the first to enter the war room, revealing that the Resistance had been betrayed in Lessu. On Corellia, Suralinda Javos of Team One needed to contact Connix on Ryloth to locate Wedge Antilles, a veteran of the Galactic Civil War and member of Team Two. Suralinda was given Team Two's coordinates, but Connix also warned her that they were evaluating Ryloth, which concerned Commander Dameron. However, while he felt like he should be protecting Organa and helping his friends on that world, he understood that he needed to complete his current mission. A message via Ryloth was also sent to Team Two, informing them that the other Corellian group had lost their ship.

During the initial assault, one of Phantom Squadron's X-wing pilots was also [killed](/article/death], although, according to what Organa saw, Hahnee was the first to fall, having been shot in the chest. While Organa witnessed it, Yendor was unaware of his daughter's death, as he and other RDA fighters were holding the First Order back at the hangar's south end so Organa and the rest of the command base could escape. Acting instinctively, Organa seized Hahnee's rifle and engaged the advancing enemies. Although her opponents took shelter, she understood the weakness of her position and that her close to empty weapon would not hold for long. However, Organa was only working to hold long enough for her allies to make it to their ships. She called for Rey's help and fought side by side with her. Eventually, the attack on their position ended, although Organa believed it was more likely that the enemy was looking for an alternate route. She also believed they would wait and attack as the Resistance left the cave. After Chewbacca informed them that it was all-clear, Organa, with Rey covering her, was able to make it aboard the Falcon.
With everyone accounted for and aboard their respective ships, Organa determined that it was time for the Resistance to evacuate. Her anger at whoever in Lessu betrayed Yendor resurfaced, and Organa believed she needed to be one who told Yendor about his daughter's death, with the General also thinking Hahnee's death was her fault. Communicating with him via her comlink, she learned that Yendor was directing two men to activate a concealed cannon to provide covering fire. After learning his daughter had died, he was informed that Charth's two children were safe. Yendor initially intended to die directing the cannon, but, after learning about the death of the Phantom Squadron pilot, Organa offered for him to pilot the leftover X-wing, which he agreed too. Following this, Organa instructed Nien Nunb and Connix to man the Falcon's turrets. In the cockpit, Rey suggested that the X-wings could lead the other ships, a plan that Organa approved. Soon enough, the Falcon was airborne and departing Ryloth.

As the united Corellian teams boarded ships and escaped the planet, they received word about the evacuation, so Dameron asked a new ally, Nifera Shu of the Collective, for a new location for the Resistance's forces. While they did set up at this safe house, Dameron believed Ryloth showcased that nowhere was safe for the Resistance. He believed they needed to scatter throughout the galaxy to grow their movement and that, eventually, they would rise up and destroy the First Order. Ultimately, in 35 ABY, the Resistance and Citizens' Fleet triumphed over the resurrected Darth Sidious and the Sith Eternal in the Battle of Exegol. Following this victory, the people of the galaxy began to rise up against the First Order.
The Battle of Ryloth was first depicted in Rebecca Roanhorse's 2019 novel Resistance Reborn and its audiobook adaptation.
During the novel, it describes some of the Resistance's advertises in the battle as simply being enemies. For these characters, this article does not assume whether they are part of the First Order or another faction, as they could have been from Lessu.