- Peninei Halakha
After the destruction of the First Temple, the prophets instituted fast days in commemoration of the terrible events surrounding its destruction and the exile of the Jews from their land. They wished to inspire the people to feel pain and mourn the destruction and the exile, and lead them to repent and rectify the evil deeds that caused all the misfortune that has been visited upon the Jewish people from then until this very day.
They instituted a fast on the tenth of Tevet (Asara Be-Tevet) because that is when King Nebuchadnezzar of Babylonia began his siege of Jerusalem. They instituted a fast in Tamuz because the walls of Jerusalem were breached in that month. The ninth of Av was established as a fast day (Tisha Be-Av) because the Temple was destroyed on that day. The third of Tishrei (Tzom Gedalia) was instituted as a fast over the murder of Gedalia ben Aĥikam – leader of the Jews who remained in Judea after the destruction of the Temple – because his death extinguished the last ember of Jewish sovereignty in Eretz Yisrael.
The Jewish people observed these fasts throughout the seventy-year Babylonian exile. When they were privileged to build the Second Temple, the question arose: Must we continue fasting on these days? The prophet Zechariah answered:
Thus said the Lord of Hosts: The fast of the fourth month (in Tamuz), the fast of the fifth month (9 Av), the fast of the seventh month (Tzom Gedalia), and the fast of the tenth month (10 Tevet) shall become occasions for joy and gladness, happy festivals for the House of Judah; but you must love honesty and integrity. (Zechariah 8:19)
Indeed, during the Second Temple era, these days became joyous festivals.
When the Second Temple was destroyed, the original enactment was reinstated for all four fast days. However, the date of the fast in Tamuz, commemorating the breach of Jerusalem’s walls, was changed. When the First Temple was destroyed, the city was breached on the ninth of Tamuz, and thus the Jewish people fasted on that day throughout the seventy-year Babylonian exile. When the Second Temple was destroyed, however, Jerusalem was breached on the seventeenth of Tamuz, which is when we have fasted ever since. Even though the four fasts were originally instituted by the prophets to commemorate the destruction of the First Temple – which is why we fast on the tenth of Tevet, which is when Nebuchadnezzar laid siege to Jerusalem during the time of the First Temple, and on Tzom Gedalia, which marks the end of Jewish sovereignty in Eretz Yisrael at the end of the First Temple era – the Sages nonetheless decided to establish the fast commemorating the breach of Jerusalem’s on the seventeenth of Tamuz (Shiva Asar Be-Tamuz), which is when the city was breached at the time of the Second Temple, because the pain of the second destruction is more acute to us. Furthermore, the verse calls that fast “the fast of the fourth month,” implying that the most important part the enactment is that it should take place sometime during the fourth month, Tamuz. Therefore, even when the Sages changed the date from the ninth to the seventeenth, they did not substantively alter the prophets’ enactment of a fast in the fourth month over the breach of Jerusalem. Nothing changed with regard to the ninth of Av, because both Temples were destroyed on that day.
 Tashbetz 2:271 explains at length that the four fasts commemorate primarily the destruction of the First Temple, which is when the divine Presence departed, and when the prophets first enacted the fasts. The Sages, who lived after the destruction of the Second Temple, did not alter the original enactment, as evident from the fact that they did not institute a fast on the day the Romans began their war on Jerusalem. We fast on the seventeenth of Tamuz instead of the ninth because the original enactment of a fast day commemorating the breach of Jerusalem referred to the month of Tamuz. Therefore, it may be moved from the ninth to the seventeenth. Ramban writes in Torat Ha-adam (p. 243, Chavel edition) that we fast on the seventeenth of Tamuz because the destruction of the Second Temple is more painful for us (based on Yoma 9b). According to the Yerushalmi, R. Tanĥum b. Ĥanila’i said that, in truth, Jerusalem was breached on the seventeenth of Tamuz during the First Temple period as well. The people simply miscalculated, thinking that the breach had occurred on the ninth, and the verse (Yirmiyahu 39:2, 52:6) did not want to deviate from what the people thought (y. Ta’anit 4:5). However, Rava states that at the time of the First Temple, the city was indeed breached on the ninth of Tamuz, while the same tragic event took place on the seventeenth of Tamuz in the Second Temple era (Ta’anit 28b). Tosafot (rh 18b, s.v. “zeh”) state that the Bavli and the Yerushalmi dispute the matter.