Two feudal lords, Asano Takumi no Kami, and Kamei Sama were going to receive an imperial envoy from the capital. A court official, Kira Kotsuke no Suke was appointed to teach the two lords the proper protocol for the visit. Kira was a harsh man, and continually insulted Asano and Kamei. Kamei was so hotheaded, that he resolved to kill Kira at the next insult. Kamei told his samurai about this and the samurai knew that it would be the death penalty for the lord if he killed Kira. One of his samurai gathered as much money as he could and used it to bribe Kira not to insult his lord.
The next day, when the imperial envoy arrived, Kira would praise Kamei but be twice as hard on Asano. Asano was outraged, when Kira turned his back on him, Asano drew his wakizashi and slashed at him. Unfortunaely, Kira was protected by a special court headgear and recieved only a superficial cut on his forehead. The shogun was outraged at Asano's act... it was forbidden to draw a sword at court. Asano was ordered to commit seppuku, and his lands were confiscated and his samurai were disbanded.
Over time, the 47 samurai of Lord Asano plotted against Kira for his actions against their dead master. Eventually, they raided Kira's compound and subdued his local guards. Finding Kira, they tried to force him to commit seppuku honorably, but he wouldn't comply so they murdered him. Hearing of this crime, the emporer ordered all of the ronin to commit seppuku. They complied, and were buried next to their lord's grave. The grave is now somewhat of a national treasure, and people make pilgrimages there to remind themselves of what the code of bushido was about.