侍 are without a doubt one of Japan's best known historical figures; the image of the proud warrior standing strong to his last breath is inseparable from almost any part of the nation's ancient history and culture. Like 忍者 (にんじゃ - ninja) though, it doesn't take long before the history ends and the fantasy begins. Let's try to keep the demons and magic swords to a minimum - the stories and legacies of some of Japan's most famous 侍 are amazing enough as they are.
In a general sense, 侍 (or "武士" (ぶし - bushi) - "warriors") are members the "warrior class" of Japan's history, but what this actually signified underwent significant changes through each different era. At times, the lines between workers and warriors were blurred somewhat and civilians were entitled to bear arms should they wish; later, weapons were forbidden for all except those of the ruling military class. In any case, 侍 were never far from absolute authority within the feudal system and have had a significant impact on the culture and traditions of the country through both war and peace. At the height of military rule when the Emperor and government were little more than figureheads, Japan had more than 200 大名 (だいみょう - daimyou - feudal lords) in charge of their own lands under the authority of the 将軍 (しょうぐん - shogun - general), each with several hundred 侍 serving them. This means that there were several clans for each modern day prefecture, all with their own unique stories.
As you might expect, these stories have been embellished and exaggerated through subsequent retellings and it's sometimes hard to separate fact from fiction. The 侍 heroes named in Japanese history certainly existed, but elements of the tales are very tall. For example, perhaps the most famous 侍 in terms of skill was known as Minamoto no Yoshitsune, featured in the 歌舞伎 (かぶき - Kabuki) play "Yoshitsune and the Thousand Cherry Blossoms". His exceptional skill with the sword has been given supernatural origins; he was apparently trained by a 天狗 (てんぐ - Tengu), a birdlike mythical creature with an extremely long nose and a knack for martial arts. Further, Yoshitsune was attacked by the towering 侍 priest Benkei, who understandably considered himself the strongest warrior around - he's said to have disarmed 999 men up to that point. Nevertheless, the thousandth proved too much for him to deal with and the priest became Yoshitsune's loyal follower. The rest is uncontroversial in a historical sense; together with his older brother Minamoto no Yoritomo, Yoshitsune led the 源氏 (げんじ - Genji or "Minamoto") clan to victory over the 平家 (へいけ - Heike or "Taira") clan and the Kamakura 幕府 (ばくふ - bakufu - Shogunate) was founded, starting the 侍 era proper.
Much of the feudal era lived up to its name, with almost constant turmoil and civil war as each of the individual clans struggled for power. Lasting peace wasn't achieved until the reign of the Tokugawa 幕府, sometimes known as the "Edo Period" after the old name for 東京 (とうきょう - Tokyo). During this time, laws regarding weapons were strictly enforced and the wearing and use of two swords became an exclusive symbol of the 侍; a full-sized 刀 (かたな - katana) that could be used with one or two hands and a smaller companion sword known as a 脇差し (わきざし - wakizashi) for close-quarters or indoor fighting. A famous self-made swordsman called Miyamoto Musashi, however, trained in the use of both swords simultaneously - occasionally even with two 刀 at once. While there is a lot of folklore around Japanese swords, Musashi is proof that a weapon is only as good as the 侍 swinging it; he had an almost flawless duelling record despite often going up against his fully armed opponents with wooden swords (and in one case, an oar). Late in his life, Musashi became a hermit and wrote a book on 武士道 (ぶしどう - bushidou - the way of the warrior) and tactics that still has an influence today.
Although the general concepts of 武士道 had been in play amongst warring 侍 for hundreds of years, when it was officially named it was considered less a combat manual and more a peacetime spiritual philosophy on how a warrior should think and act. It encouraged 侍 to read and develop their other skills, promoting discipline and loyalty when there wasn't much actual fighting to be done. The reason for the enduring peace was the strength of the Tokugawa 幕府; 大名 were kept on a tight leash and expected to visit Edo regularly to show allegiance to the 将軍. At all other times, they were kept busy with building infrastructure and collecting taxes; the rules and regulations were strongly enforced and few would have had the time or resources to organise revolts. Essentially, the 幕府 did whatever it took to ensure its continued power, which is why it survived for 300 years.
That's not to say it was all smooth sailing - the politics of the feudal system were extremely complicated and fighting amongst the clans and the 幕府 resulting from perceived slights were not unheard of. The most famous example of this is known as the 四十七士 (しじゅうしちし - shijuu shichi shi - "47 Samurai") of the 赤穂 (あこう - Ako) clan in 兵庫県 (ひょうごけん - hyougoken - Hyogo Prefecture), usually referred to in the West as the "47 Ronin". The story began in March 1701 when Asano Takuminokami, 大名 of the 赤穂 clan, was visiting Edo Castle under the care of a 幕府 official known as Kira Kozukenosuke. What exactly started their grudge is not clear, but it's said that Lord Kira purposely withheld information from Lord Asano about the delicate rules and regulations of the trip and constantly made fun of his resulting slipups. Eventually able to bear no more, Asano drew his sword in one of the castle corridors and slashed at Kira, injuring him before being overpowered. Needless to say, even drawing a weapon within the castle was strictly forbidden. The law was clear in this though - regardless of who was at fault, both parties to a disagreement were considered guilty and would be punished accordingly. Despite that, the 幕府 sentenced Lord Asano to commit 切腹 (せっぷく - seppuku - ritual suicide) but left Lord Kira entirely unpunished.
The judgement was widely considered extraordinary by citizens and 侍 alike, but it was carried out nonetheless; the 幕府 crushed the 赤穂 clan and seized their castle, Lord Asano's family were stripped of their lands and all his 侍 were left masterless. In secret though, the former chief 侍 Ooishi Kuronosuke was gauging support amongst the remaining 浪人 (ろうにん - ronin) for a plan to avenge their former master and redress the judgement of the 幕府. This was easier said than done - as 浪人 they no longer had any source of income and had to find ways to disappear in the meantime to avoid suspicion. After almost two years of hardship, the 浪人 met up in Edo then stormed Kira's mansion, killed him and surrendered to the police. Unfortunately there's no happy ending to the story - the perpetrators were sentenced to commit 切腹 - but it's widely believed that their sacrifice helped to right the wrongs of 1701.
The 四十七士 hold a special place in Japan's heart for their unerring honour, loyalty and determination and the story has been retold countless times through period dramas, movies, 歌舞伎 and 文楽 (ぶんらく - bunraku - Japanese puppet theatre) throughout the past 300 years; it's such a popular subject that its adaptations are referred to with their own title - 忠臣蔵 (ちゅうしんぐら - chuushingura). On December 14th every year, 赤穂 commemorates the anniversary of the raid with a festival known as the 赤穂義士際 (あこうぎしさい - akou gishi sai - Ako Loyal Samurai Festival). This involves reenactments, parades and walking tours of the town that pass through museums, shrines, temples, statues and monuments dedicated to Ooishi and each of the other 浪人.
In the dying days of the Tokugawa 幕府, the political situation had changed markedly and 侍 gradually found themselves out of place in an increasingly modern society. Some embraced the change and took an active role; a 侍 known as Sakamoto Ryoma, for example, helped to ally the enemies of the 幕府 who then went on to topple the 将軍 and officially begin the 明治 (めいじ - Meiji) Period. Ryoma could see the benefits of newer technologies - he was quite fond of pistols - and recognised that Japan needed to leave the feudal system behind if they wanted to keep up with the rest of the world. Many 侍 joined the new government or laid down their weapons and took up other jobs, but others resisted the pressure to modernise and after several clashes with the government and foreign nationals, the remaining 侍 clans united in a rebellion led by a man called Saigo Takamori. Despite realising their revolt was hopeless, Saigo and his men maintained their pride and fought against the now modernised Japanese army. Their resounding defeat marked the end of the 侍 era and was very loosely adapted for the screen in "The Last Samurai". A statue of Saigo now stands in Ueno Park in 東京 to preserve his memory.
Exaggerations and embellishments aside, the 侍 were just as human and fallible as the rest of us but it's hard to argue against their remarkable contribution to Japanese history and culture; they helped to shape the nation throughout 700 years of war, peace, betrayals and revenge. They also represent the romantic ideals of loyalty, vigilance and sacrifice, which must be why they hold such an enduring appeal to Japan and the wider world. I'm sure their regular appearances in games, movies, tv shows, books and toy shops have nothing to do with the demons and magic swords whatsoever.