The Seleucids (Syrian-Greeks) under Antiochus Epiphanes (2nd century BCE), at the instigation of the Hellenizers, had forbidden various Torah-practices such as Sabbath-observance and circumcision, rededicated the Jewish Temple to a Greek idol, and pressed the Jews to offer up sacrifices to the idol. One of the leading elder Jewish sages called upon the people to keep observing the Torah anyway; and if necessary, to use force in resisting the decrees.When a Hellenized Jew offered a sacrifice to the Greek idols in a nearby village, the sage killed him as well as the Greek overseer. This brought a violent reaction from the Greeks; and the loyal Jews, led by the Hasmonean family, were forced to retreat from their towns and strike out at the Greeks in an attempt to oust them from the Holy Land and to enable the people to once again observe the Torah. The Torah-Jews were heavily outnumbered by the attacking Greek armies, but God gave them miraculous victories again and again.
After three years of struggle, the Greek armies retreated from Jerusalem, and the Hasmoneans (also called Maccabees) entered the Holy Temple which the Greeks had defiled, reconsecrated it to God, and began the Temple service once more.
Among other things, they wanted to relight the olive oil candelabrum (Exodus ch.25), but could only find one day's supply of undefiled oil - and it would take eight days to make and bring some more. Miraculously, the menorah stayed lit for eight days (Talmud, Shabbat 21b), allowing enough time for new oil to be prepared and brought.
The significance of the miracle is that it demonstrated that God's presence was still there. The Torah-community was overjoyed, because God's presence meant everything to them. This is what Hanukkah represents: the closeness to God; and the avoidance of Hellenization (assimilation).
The Torah-Sages instituted the festival of Hanukkah at that time (Talmud, Shabbat 21b), to publicize the miracle (Rashi commentary, ibid). This is why we light our Hanukkah-menorahs. (The Hanukkah-menorah, or hanukkiyah, is a special form of the original seven-branched menorah. Our Hanukkah-menorahs have eight spaces for oil, or candles, to mark each of the eight days for which the oil lasted, and a ninth to hold the shamash, a candle used to light the others.)
The Al-Hanisim prayer which we recite during Hanukkah centers around the Hasmoneans' victory and rededication of the Temple, while the candle-lighting commemorates the miracle of the oil. Though the military victory is prominently mentioned in the prayers, it wouldn't have been celebrated if not for the miracle of the oil.
It should also be noted that the main goal for which the Maccabees fought was not political independence. They fought to enable the people to observe the Torah's commandments; as we say in the Al Hanisim prayer: "The Greeks sought to cause us to forget Your Torah and leave Your statutes."