Having existed for well over a millennia, the original Jedi Order were the guardians of peace and justice in the both the Old Republic and the Galactic Republic afterwards. The Jedi maintained the peace in the Republic until 19 BBY, when—in the final days of the Clone Wars—Supreme Chancellor Sheev Palpatine, secretly the Dark Lord of the Sith Darth Sidious, declared himself emperor and ordered the extermination of the Jedi. Few Jedi survived, including Obi-Wan Kenobi and Yoda.
Over the next nineteen years, the Jedi remained in exile, until in 0 BBY, Obi-Wan, under the name "Ben Kenobi," took Luke Skywalker—the son of his former pupil, Anakin Skywalker, who had become Darth Vader—briefly as a student. He later perished aboard the first Death Star, but Luke lived on. Later, after the Battle of Hoth, Luke followed Kenobi's instructions and met Yoda on Dagobah where he received more Jedi training. Finally, in 4 ABY, after his victory in the Battle of Endor, Luke was proclaimed the last living Jedi in the galaxy.