02 Jun Yerushalayim is the Ir Melucha
The Rambam (Hilchos M e l a c h i m 1:10) rules that only a king of malchus Beis Dovid has the right to use Yerushalayim as his capital and establish his government offices there. This halachah is based on the combination of two premises. First, this halachah reflects the fact that malchus Beis Dovid has a special halachic status. Hashem authorizes only such a king, of the malchus hanivcheres (chosen monarchy), to serve as the human representative of the kingdom of Hashem in His land (see Chiddushei Maran Ri”z HaLevi al haTorah, Parshas Shoftim). In addition, we see that Yerushalayim has been halachically declared the official capital of the Jewish government in Eretz Yisrael. The official capital is reserved for the official government of Eretz Yisrael, and that is the malchus Beis Dovid in particular. Both of these principles are reflected in a requirement of the berachah of Boneh Yerushalayim in Birchas HaMazon. We must include thanks regarding malchus Beis Dovid within this berachah of thanks to Hashem for Yerushalayim: “Whoever did not say ‘the kingdom of the House of Dovid’ in the berachah of Boneh Yerushalayim, has not discharged his obligation” (Berachos 48b). This may be a requirement even on a level of d’oraisa (Bi’ur Halachah, Orach Chaim 187:4). The establishment of this kingdom, the malchus hanivcheres, is necessary for Yerushalayim to be considered complete, in a state of binyan. Similarly, the Tosefta in Berachos (3:25) states that one has the option of reciting two berachos in the Shemoneh Esrei, Velirushalayim Ircha and Es Tzemach Dovid, in combination or individually. The berachah requesting the rebuilding of Yerushalayim and the berachah requesting the re-establishment of malchus Beis Dovid are interconnected. Indeed, the Tosfos Ri”d (Ta’anis 13b) writes that the custom followed in Eretz Yisrael was to combine these two themes into a single berachah. That is why the krovetz of Purim contains a piyyut for every berachah of Shemoneh Esrei except Es Tzemach; the paitan did not have Es Tzemach as a separate berachah. The Tosfos Ri”d explains that this is why we refer to the weekday Amidah as “Shemoneh Esrei” even though we recite nineteen berachos. These two berachos were merged into one in many communities until the Middle Ages. Even according to our nusach, in which the berachah of Es Tzemach is recited seperately, we continue to include the וכסא דוד מהרה לתוכה תכין– ,phrase “and may You speedily establish the throne of Dovid within it,” in Velirushalayim Ircha because the concept of malchus Beis Dovid is integral to the complete building of Yerushalayim. [See B’Ikvei HaTzon, p. 222.] Meforshim note that Dovid HaMelech was annointed three times, (Shmuel I 16:13, Shmuel II 2:4, and Shmuel II 5:3). The second, public meshichah was necessary because the first was merely a private anointing in the presence of Shmuel and Dovid’s family. The third one was necessary because it was in anticipation of Dovid’s relocating the seat of his government from Chevron to Yerushalayim; only then was his kingdom complete.