According to the popular legend, when the Maccabees recaptured the Temple, they went to re-light the Menorah lamp that was supposed to stand continually in the presence of God. For more on the symbolism of the Menorah, click here. However, there was only enough sanctified oil to burn the Menorah for 1 day. It would take eight days before more oil could be supplied. Miraculously, the oil in the Menorah did not burn out, but burned for the full eight days. Not until more oil was finally available did the oil burn out. We burn the Hanukkiah Menorah through the eight days of Hanukkah as a remembrance of this miracle.
The story of Hanukkah is found in the book of I Maccabees. (The books of Maccabees are apocryphal books.) The following are exerts from the first chapters of the book of I Macabees.
Exerts from the Book of Maccabees
And after that Antiochus had smitten Egypt, he returned again in the hundred forty and third year, and went up against Israel and Jerusalem with a great multitude, and entered proudly into the sanctuary, and took away the golden altar, and the menorah of light, and all the vessels thereof, and the table of the shewbread, and the pouring vessels, and the vials and the censers of gold, and the veil, and the crown, and the golden ornaments that were before the temple, all which he pulled off. He took also the silver and the gold, and the precious vessels: also he took the hidden treasures which he found. And when he had taken all away, he went into his own land, having made a great massacre, and spoken very proudly. Therefore there was a great mourning in Israel, in every place where they were. (1 Maccabees 1:20-25)
Moreover king Antiochus wrote to his whole kingdom, that all should be one people, and every one should leave his laws: so all the heathen agreed according to the commandment of the king. Yea, many also of the Israelites consented to his religion, and sacrificed unto idols, and profaned the Sabbath. For the king had sent letters by messengers unto Jerusalem and the cities of Judah that they should follow the strange laws of the land, and forbid burnt offerings, and sacrifice, and drink offerings, in the Temple; and that they should profane the Sabbaths and festival days: And pollute the Sanctuary and holy people: Set up altars, and groves, and chapels of idols, and sacrifice swine's flesh, and unclean beasts: That they should also leave their children uncircumcised, and make their souls abominable with all manner of uncleanness and profanation: To the end they might forget the Torah, and change all the ordinances. And whosoever would not do according to the commandment of the king, he said, he should die. (1 Maccabees 1:41-50)
Now the fifteenth day of the month Kieslev, in the hundred forty and fifth year, he set up the Abomination of Desolation upon the altar, and built idol altars throughout the cities of Judah on every side; And burnt incense at the doors of their houses, and in the streets. And when they had rent in pieces the books of the Torah which they found, they burnt them with fire. And whosoever was found with any the book of the Testament, or if any committed to the Torah, the king's commandment was, that they should put him to death. Thus did they by their authority unto the Israelites every month, to as many as were found in the cities. Now the five and twentieth day of the month they did sacrifice upon the idol altar, which was upon the altar of God. At which time according to the commandment they put to death certain women, that had caused their children to be circumcised. And they hanged the infants about their necks, and rifled their houses, and slew them that had circumcised them.
Howbeit many in Israel were fully resolved and confirmed in themselves not to eat any unclean thing. Wherefore they rather chose to die, that they might not be defiled with meats, and that they might not profane the holy covenant: so then they died. And there was very great wrath upon Israel. (1 Maccabees 1:54-64)
In those days arose Mattathias the son of John, the son of Simeon, a priest of the sons of Joarib, from Jerusalem, and dwelt in Modin. And he had five sons, Joannan, called Caddis: Simon; called Thassi: Judas, who was called Maccabeus: Eleazar, called Avaran: and Jonathan, whose surname was Apphus. And when he saw the blasphemies that were committed in Juda and Jerusalem, he said, "Woe is me!" In the mean while the king's officers, such as compelled the people to revolt, came into the city Modin, to make them sacrifice. (1 Maccabees 2:1-15)
(In the city of Modin, Matthathias and his sons revolted against the king's officers rather than make a sacrifice to an idol.)
And Mattathias cried throughout the city with a loud voice, saying, "Whosoever is zealous of the Torah, and maintaineth the covenant, let him follow me." So he and his sons fled into the mountains, and left all that ever they had in the city. (1 Maccabees 2:27-28)
(There in the mountains, all those who were zealous for the Torah gathered around Mattathias and his sons to form a small outlaw army. Mattathias himself was very old. He died in the hills and his son Judah the Maccabee took charge of the small rebel group.)
And when the enemy came near to the going up of Bethhoron, Judah went forth to meet him with a small company: Who, when they saw the host coming to meet them, said unto Judah, "How shall we be able, being so few, to fight against so great a multitude and so strong, seeing we are ready to faint with fasting all this day?" Unto whom Judah answered, "It is no hard matter for many to be shut up in the hands of a few; and with the God of heaven it is all one, to deliver with a great multitude, or a small company: For the victory of battle standeth not in the multitude of an host; but strength cometh from heaven. They come against us in much pride and iniquity to destroy us, and our wives and children, and to spoil us: But we fight for our lives and our Torah laws. Wherefore the Lord himself will overthrow them before our face: and as for you, be ye not afraid of them." (1 Maccabees 3:16-22)
(Judah and his brothers, the Maccabees fought many battles for many years. They suffered defeats but also achieved many miraculous victories. In battle after battle, the few overpowered the many, the week overturned the strong. Against overwhelming odds, miraculous intervention shifted the battles until at last they were able to take back Jerusalem.)
Then said Judah and his brethren, Behold, our enemies are discomfited: let us go up to cleanse and dedicate the sanctuary. Upon this all the host assembled themselves together, and went up into Mount Zion. And when they saw the sanctuary desolate, and the altar profaned, and the gates burned up, and shrubs growing in the courts as in a forest, or in one of the mountains, yea, and the priests' chambers pulled down; They rent their clothes, and made great lamentation, and cast ashes upon their heads, And fell down flat to the ground upon their faces, and blew an alarm with the shofars, and cried toward heaven. Then Judah appointed certain men to fight against those that were in the fortress, until he had cleansed the sanctuary.
So he chose priests of blameless conversation, such as had pleasure in the Torah: Who cleansed the sanctuary, and bare out the defiled stones into an unclean place. And when as they consulted what to do with the altar of burnt offerings, which was profaned; They thought it best to pull it down, lest it should be a reproach to them, because the heathen had defiled it: wherefore they pulled it down, And laid up the stones in the mountain of the temple in a convenient place, until there should come a prophet to shew what should be done with them. Then they took whole stones according to the law, and built a new altar according to the former; And made up the sanctuary, and the things that were within the temple, and hallowed the courts. They made also new holy vessels, and into the temple they brought the candlestick, and the altar of burnt offerings, and of incense, and the table. And upon the altar they burned incense, and the lamps that were upon the candlestick they lighted, that they might give light in the temple. Furthermore they set the loaves upon the table, and spread out the veils, and finished all the works which they had begun to make.
Now on the five and twentieth day of the ninth month, which is called the month Casleu, in the hundred forty and eighth year, they rose up betimes in the morning, And offered sacrifice according to the law upon the new altar of burnt offerings, which they had made. Look, at what time and what day the heathen had profaned it, even in that was it dedicated with songs, and citterns, and harps, and cymbals. Then all the people fell upon their faces, worshipping and praising the God of heaven, who had given them good success. And so they kept the dedication of the altar eight days and offered burnt offerings with gladness, and sacrificed the sacrifice of deliverance and praise. They decked also the forefront of the temple with crowns of gold, and with shields; and the gates and the chambers they renewed, and hanged doors upon them. Thus was there very great gladness among the people, for that the reproach of the heathen was put away. Moreover Judah and his brethren with the whole congregation of Israel ordained, that the days of the dedication of the altar should be kept in their season from year to year by the space of eight days, from the five and twentieth day of the month Kislev, with mirth and gladness. (1 Maccabees 4:36-59)