In 1701, Tokugawa Tsunayososhi, the ruling Shogun of Japan, ordered two Daimyo (lords), Asano Naganori, Lord of Akō and Kamei Sama, to organised a reception for the envoys of the Emperor in Edo, the ancient name of Tokyo.
Asano and Kamei were to be given instruction in the necessary court etiquette by Kira Yoshinaka, a rude, arrogant and powerful master of ceremony in the hierarchy of Tokugawa Tsunayoshi's shogunate.
Lord Kira was accustomed to receive gifts of a monetary nature for his teaching, but Lord Asano's gift to him was the simple token gift of dried bonito fish. Kira was a man greedy of money, he was insulted and upset at the two Lords, and treated them poorly during his teaching. The two man did not offer bribes to Kira, like many officials do.
During their instruction, Asano and Kamei were constantly insulted by Kira. At one point, Kamei Sama became so enraged, that he came close to kill Kira to avenge the insults. However, the Lord's counselors suggested, in order to avoid disaster, to give Kira a large bribe. Soon after, Lord Kira started to treat Kamei Sama very nicely.
Kira continued to treat Lord Asano harshly, and humiliated him in public calling him a "country boy with no manners".
Asano lost his temper and could restrain himself no more. He drew his wakizashi (forbidden inside Edo Castle) and attacked Kira but only wounded him slightly in the face before being stopped by guards.
Kira's wound was superficial, but attacking a shogun official into government building, was considered to be a grave offense. Any form of violence was expressly forbidden inside Edo castle.
As a punishment for his severe offense, the Shogun Tsunayoshi ordered Lord Asano to commit seppuku (ritual suicide). Asano forfeited his life the very same day. As for Kira, he received sympathy as he continued his official duties.
At the time, law stated that when a Daimyo committed seppuku, the Shogun family is dishonored, his castle confiscated and his Samurai retainers disband, thus becoming Ronin or masterless Samurai.
As he heard the terrible news, Oishi Kuranosuke, Asano's principal counselor, moved his Lord's family away, before surrendering Ako castle to the Officials of the Tokugawa government.
Oishi secretly formed a group to avenge their master's death. Out of 371 samurais, only loyal 47 men (you can find here the names of all the 47 ronin and a description of their weapons) refused to allow lord Asano's death to go unavenged, even though vendetta is strictly forbidden by law.
They decided to go on with their plan, even though they knew they would be severely punished for doing so, swearing a secret blood oath to avenge their master by killing Kira.