Amidah-Purim-Building the Temple
Immediately after the chapter in the Torah concerning the destruction of Amalek there follows the law of the sanctity of the Temple site. So our Sages declare, “The people of Israel were instructed in the performance of three mitzvot upon their entering Israel: to appoint a king over them, to destroy the seed of Amalek, and immediately afterward to build the holy Temple (Sanhedrin 20b).”
This is also why our Sages placed the chapter of “The People of the City,” dealing with the laws of the sanctity of a synagogue and house of study, in tractate Megillah which deals with the commemoration of the downfall of the Amalekite Haman.
Thus too the sequence in the verse, “All the horns of the wicked will I cut off; but the horns of the righteous shall be lifted up (Psalms 75:11).” The Sages explain, “Wherein is their horn uplifted? In Jerusalem (Megillah 17b).” This means that the uplifting of the horn of Israel is limited to a sanctified locale in Israel and cannot be diffused, lest it be nullified. Now, synagogues and houses of study have the sanctity of Israel, as the Sages state that these sacred edifices in the Diaspora will all be transposed to Israel at the time of redemption (Megillah 29a).
The three aforementioned mitzvot are linked together. When one person is somewhat exalted above others in the building of a new synagogue or house of study, which our Sages considered a miniature Temple, it is like the appointment of a king. (Tzidkat haTzaddik #176)
“And to Jerusalem, Your city, may You return in compassion, and may You rest within it, as You have spoken. May You rebuild it soon in our days as an eternal structure, and may You speedily establish the throne of Your servant David within it.” Purim time, when we destroy Haman and Amalek, is the perfect preparation for the rebuilding of the Temple and the appointment of King David.