The Talmud maintains a rule in many locations that one is not allowed to sit in the courtyard of the Holy Temple in Jerusalem. In most points of reference to this law, the Talmud then proceeds to explain that a king of the House of David is allowed to sit in the Temple courtyard. Rabbi Yissachar Ber Eilenberg (1570-1623) writes that in the Jerusalemic Talmud there is an opinion who understood that even a Davidic king is not allowed to sit in the Temple Courtyard. This opinion is stated by Rav Ami the Jerusalemic Talmud in the name of Rabbi Shimon ben Lakish. However, the Amudei Yerushalayim asks how Rav Ami can say such a thing in the name of Rabbi Shimon ben Lakish, if he also said in his name that the law is that one cannot sit in the courtyard except in the place of the kings of David. This second law refers to the fact that there was a throne near the courtyard designated for the Davidic kings, upon which anyone was allowed to sit. The Amudei Yerushalayim answers based on the words of Rabbi Menachem Azariah of Fano (1548-1620) that the prohibition barring one from sitting in the Temple's courtyard is only in the future in the Third Holy Temple, but until then one is permitted to sit in the Courtyard. The Jerusalemic Talmud records an opinion that even if a Davidic King is not allowed to sit in the courtyard, the Kohen Gadol is surely allowed to sit there because the Torah explicitly mentions Eli the Kohen Gadol sat there.
Rabbi Yehuda Roseannes (1657-1727) was unsure whether the prohibition that bans sitting in the courtyard is rabbinic or Biblical in its origin. Rabbi Roseannes writes that the prohibition cannot be merely rabbinical in its origin because the Talmud used the existence of this prohibition to prove that the prophet Samuel did not literally sleep in the Temple as a lad. Had the prohibition been merely rabbinic, it is not necessarily true that the rabbis had already decreed this prohibition in the times of Samuel. However, Rabbi Roseannes asks that if the prohibition is indeed biblical in origin, then the Mishnah should have listed that the Temple's courtyard has a higher degree of sanctity as it listed all the other places in ascending order of their holiness. Rabbi Yechiel Michel Epstein (1829-1907) writes that the prohibition is not biblical because then there is no rationalization for it not to apply to Davidic Kings, nor is it rabbinic because then the Talmud would not have been able to prove that Samuel did not literally sleep in the Holy Temple complex. Rather, he writes that the prohibition is in a quasi-rabbinical, quasi-biblical state, for it was a rabbinical law (Divrei Kabbalah) instituted by Moses in an effort to show honor to the future kings of Israel. Indeed, Rabbi Yitzchok Zev Soloveitchik (1886-1959) wrote that one who sat in the courtyard was considered rebelling against the king and could justifiably be given the death penalty for treason.
Maimonides writes that the prohibition of sitting in the courtyard is an extension of the biblical commandment of "Fear my Sanctuary"; Rabbi Moshe ben Yoseph of Trani (1505-1585) and Rabbi Yosef Babad (1801-1874) also write that the prohibition of sitting in the courtyard is an extension of that biblical precept. If the prohibition is biblical, then why did the Mishnah in Tractate Keilim not lost the higher sanctity of the Temple courtyard? Rabbi Yehoshua Yosef HaKohen of Mard, Poland writes that even if the prohibition stems biblically from the commandment about fearing the sanctuary, the root of the prohibition is not the sanctity of the courtyard in the Holy Temple, rather it is the honor of HaShem, which is slighted should one sit in the courtyard. Rabbi Meir Simcha HaKohen of Dvinsk (1843-1926) writes that according to Maimonides, even a Kohen Gadol is not allowed to sit in the Temple courtyard. He explains that the opinion in the Midrash, which allowed the Kohen Gadol to sit there, did not mean that the Kohen Gadol is not included in the commandment of fearing the sanctuary. Rather, that opinion held that it is a greater honor for Heaven to allow the Kohen Gadol, who wears the Tzitz, to sit in the courtyard rather than to make him stand. These commentaries understand that Maimonides held that the prohibition of sitting in the courtyard is biblical, however Rabbi Yosef Karo (1488-1575) writes that just as Rashi understood (see below) that the prohibition is a Masoretic tradition, so too Maimonides understood that it is a Masoretic tradition.
Various passages in Tosafos understand the nature of the prohibition in two different ways. In one location, the Tosafists write that this prohibition is rabbinic, yet in other locations, the Tosafists seem to understand that the prohibition is biblical in origin. The former Tosafos understands that although usually one is not allowed to sit in the courtyard, one is allowed to sit in the courtyard when eating the sacrificial meat of the offerings in the Holy Temple. This passage in Tosafos understands that since the prohibition is only rabbinic, the rabbis never decreed that one is not allowed to sit in the courtyard when eating from the sacrificial meat. However, the latter Tosafos understands that the prohibition of sitting in the courtyard is biblical and thus Tosafos required hermeneutical extractions to permit the eating of sacrificial meats while sitting in the courtyard. Tosafos explain that eating the sacrificial meats is considered part of the Temple services, and just as other components of the services are theoretically allowed to be done while sitting in the courtyard, so too the eating of the sacrificial meats are allowed to be done while sitting in the courtyard. Rabbi Chaim Kanievsky points out that a third view is espoused by another Tosafos: Piskei HaTosfos writes that one is not allowed to eat the sacrificial meats while sitting in the courtyard. Accordingly, this Piskei HaTosfos understands that the prohibition of sitting in the courtyard is not only biblical, but it is so strong that there is never justification for sitting in the courtyard—even when eating from the sacrificial meats. Indeed, Rabbi Yaakov Tzvi ben Aryeh Leib Jolles writes that the discussion of whether or not one can sit down in the Temple courtyard to partake in the sacrificial meats is dependent on whether that prohibition to sit there under normal circumstances is rabbinical or biblical.
Rashi writes that the law barring one from sitting in the Temple courtyard is based on a Masoretic tradition passed down orally from generation to generation, originally given to Moses at Mount Sinai. Rabbi Elazar Landau explains that although the wording of the Masoretic rule was quoted as "There is not sitting in the Courtyard except for Judean kings" in Sanhedrin 101b, that was the exact wording of the tradition until King David was chosen. After the anointment of King David, the practical application of the rule changed to the more commonly quoted "There is not sitting in the Courtyard except for kings of the House of David". Rabbi Yair Chaim Bachrach (1639-1702) lists the prohibition of sitting in the courtyard in his enumeration of purely Masoretic laws. Rabbi Zvi Hirsch Chajes (1805-1855) asks that if this law is purely based on a Sinaitic tradition, how can there be any arguments regarding the application of the law, everyone has to agree to it. Elsewhere, however, Rabbi Chajes writes that a Masoretic law is not necessarily a law that is totally agreed upon by all, rather it is a law that its basic premise is agreed upon, but its minute details in practical applications can be disputed. Therefore, even though whether or not this prohibition applies to a Davidic King or a Kohen Gadol remains disputable, one can still consider the prohibition against a commoner, which is universally agreed upon, a Masoretic tradition. However, Rashi also writes that there is a Scriptural source for the prohibition against sitting in the Temple courtyard, that is, the verse that says, "To stand and to serve" concerning the services of the Holy Temple. Accordingly, Rashi does not seem to understand that the source is purely Masoretic; he learns that there is even a scriptural imperative.
Rabbi Aryeh Leib Malin (1906-1962) offers a radical explanation behind the prohibition of sitting in the courtyard. He explains that there is a general prohibition of needlessly entering the courtyard of the Holy Temple, but when one enters the courtyard and stands there, then such a person is fulfilling the commandment of "To stand and to serve" because merely standing in the Temple courtyard is considered a ritual service. However, if one does not stand in the Temple courtyard, rather he sits, then his entering the Temple's courtyard was pointless and he is transgressing the prohibition of entering the courtyard in vain. Rabbi Leib Malin explains that kings of the Davidic dynasty have a special commandment to be inside the courtyard—regardless of whether they are standing or sitting—so their entrance into the courtyard can never be considered in vain, even if they sit there. . With this explanation, one can answer the question of Rabbi Eilenberg who asked according to Rashi that the prohibition is a Masoretic tradition, why does Rashi also need a scriptural source. This is because Reb Leib explains the seeming contradiction in Rashi who wrote in one place that the prohibition is a Masoretic tradition, yet in another place sourced the prohibition in the verse of "To stand and to serve"; the Masoretic tradition forbids entering the courtyard unnecessarily, while the verse justifies entering the courtyard to stand. Accordingly, Rabbi Malin explains that when Tosafos wrote that the Kohen Gadol is allowed to sleep in the Holy Temple during the seven-day period before Yom Kippur, Tosafos is saying that just as a Davidic King has a commandment to remain inside the Holy Temple, so too the Kohen Gadol in the week preceding Yom Kippur has such a commandment. Nonetheless, Rabbi Malin does not account for the explanation of Rashi who wrote that the one cannot sit in the courtyard is simply because doing so is not honoring Heaven.
Rabbi Shneur Kotler (1918-1982) writes that every time that one is in a situation that is considered "in front of HaShem" then one is not allowed to sit. The Talmud writes that the source that Davidic Kings are allowed to site in the courtyard is that the Torah says, "King David came and he sat in front of HaShem". In the time of King David, a Holy Temple did not yet exist, yet the Talmud still understood that the prohibition of sitting in the Temple courtyard still applied. How then could such a prohibition apply, if the courtyard did not yet exist? Rather, the Talmud must have understood that the prohibition does not specifically prohibit sitting the courtyard of the Holy Temple in Jerusalem, rather the prohibition includes sitting in any situation where one is "in front of HaShem". Therefore, the fact that King David sat in the Tabernacle shows that all Davidic kings are allowed to sit "in front of HaShem" including in the courtyard of the Holy Temple. Rabbi Kotler writes that according to this explanation, even if the prohibition of sitting in the courtyard were biblical, the Mishnah in Tractate Keilim would not have listed this as another level of sanctity. This is because the prohibition associated with the sanctity of the courtyard is not dependent on the actual sanctity of the geographical location of the courtyard; rather, it is because the courtyard is considered "in front of HaShem." According to Rabbi Kotler, one can explain that when Moses said to the Israelites "You are all standing in front of HaShem, you G-d" that Israelites had to stand because they were "in front of HaShem". Rabbi Yeshayah of Trani (1180-1250) writes that the prohibition of sitting in the courtyard is only in the airspace of the actual courtyard, for only then is one "in front of HaShem", so he understood that the prohibition is not bound by geographical locations, rather it is dependant on whether or not one's location is "in front of HaShem".
According to the opinion cited earlier from the Midrash Shocher Tov, who learned that even Davidic Kings could not sit in the courtyard, how then did King David sit there? One can answer that there was not yet any prohibition of sitting in the courtyard because the Holy Temple was not yet built in King David's days. Alternatively, the Midrash says that King David did not literally, "sit in front of HaShem" rather he "sat in prayer", meaning "engaged in prayer 'in front of HaShem'" but did not actually sit. Additionally, the Rav Chisda answers that King David sat in the Women's Courtyard, not in The Courtyard of the Holy Temple. In describing the ceremony of HaQhell, the Mishnah says that King Agrippa sat while reading from the biblically prescribed passages. The Talmud asks how the king could have sat if sitting in the courtyard is forbidden. Furthermore, even if Davidic Kings were allowed to sit in the courtyard, King Agrippa was Herodian, not Davidic, so he should not have been allowed to sit. The Talmud answers that just as Rav Chisda explained that King David did not sit in The Courtyard of the Holy Temple, rather he sat in the Women's Courtyard, so too King Agrippa did not read the ceremonial passages of the HaQhell ritual in The Courtyard, rather he read it in the Women's Courtyard, as well.
 Yoma 25a, Yoma 69b, Sotah 40b, Sotah 41b, Kiddushin 78b, Sanhedrin 101b, and Tamid 27b
 Be'er Sheva (a Tosafos-like commentary) to Tamid 27a
 Yoma 3:2, Pesachim 5:10, and Sotah 7:7
 Midrash Shocher Tov (to Psalms) §1
 See Mahari Katz to Midrash Shocher Tov §1
 Rema mi'Panu, Asara Ma'amaros, Ma'amar Im Kol Chai part 3, §10, see also Yad Yehuda ad loc.
 He also writes there that King Rechavam, the son of King Solomon, was supposed to be the Messiah with Jeroboam being his viceroy, but since the latter had higher aspirations, he splintered off from the Kingdom of Judah and started the Kingdom of Israel with Ten Tribes, styling himself King Jeroboam of Israel.
 The Midrash says (Midrash Shocher Tov to Psalms 110:1) that HaShem told Abraham, "Sit to my right." How could Abraham have sat in front of HaShem? One can answer that Abraham was a Kohen Gadol as the Midrash says elsewhere (Yalkut Shimoni to Psalms, §869). Rabbi Avraham Abele HaLevi Gombiner (1633-1683) proved (Zayis Ra'anan) that Abraham had the status of a Kohen Gadol. He explains that the Halacha is that an Onan, one whose close relative died on that die, cannot perform the services in the Holy Temple. Therefore, had Abraham slaughtered his son Issac, he would not have been able to offer his son as a sacrifice because Abraham would have had this status of a mourner for his dead son and would be barred from offering sacrifices on the altar. However, if one explains that Abraham had the status of a Kohen Gadol, who is supposed to perform the Temple services even as an Onan, then one could explain how Abraham was Halachikly supposed to offer his son Issac as a sacrifice.
 Samuel 1 1:9
 See Mishnah L'Melech to Maimonides' Laws of Beis HaBechirah 7:6
 Kiddushin 78b
 Tractate Keilim, Chapter 1
 Aruch HaShulchan HeUsid, Kodshim, §14:14
 Chiddushei HaGriz Al HaTorah (stencil) §165
 Sefer HaMitzvos #21
 Leviticus 26:2
 Kiryas Sefer to Maimonides' Laws of Chagigah, Chapter 3 and Laws of Beis HaBechirah, Chapter 7
 Minchas Chinuch #244
 Ezras Kohanim on tractate Middos
 Perhaps then, one can explain that when Elisha ben Avuyah saw Metatron sitting in Heaven and recording the deeds of Israelites, he saw that the archangel was dishonoring HaShem by sitting in front of Him (Chagigah 15a). Perhaps this is what led Acher to apostasy.
 Ohr Somayach to Maimonides' Laws of Kings 2:4
 Kesef Mishneh to Maimonides' Laws of Sanhedrin 14:12
 The reason why Rashi (see below) understands that the prohibition is a Masoretic tradition is that the Talmud (Sanhedrin 101b) says Gemiri before introducing the law that one is not allowed to sit in the courtyard. Rashi understands that the term Gemiri refers to a Sinaitic law. Rabbi Yosef Karo here is assuming that Maimonides follows the same understanding, however Rabbi Yisrael Lipschutz of Danzig (1782-1860) proves (Tiferes Yisroel to Yoma 2:2) that Maimonides does not understand that Gemiri means a Sinaitic law.
 To Zevachim 16a
 See Tosafos to Yoma 25a
 Although, usually this rule would never be applicable because most Temple services are required to be done while standing
 Although Tosafos only proves that eating is considered a ritual service of the Holy Temple, but does not prove that eating while sitting is, once Tosafos has proved that one is allowed to eat in the courtyard, then certainly one must be allowed to sit while eating, for eating while standing is considered a dangerous act (see Maimonides, Laws of Mental States 4:3). Alternatively, Tosafos explain that it is the way of kings to eat while sitting, so presumably only eating while seated show proper honor to HaShem while partaking from His banquet meat.
 Siach HaSadeh to Yoma 25a
 To Sotah §10
 Melo HaRoim, Kllalei HaShas, Ein Yeshiva B'Azara
 To Sanhedrin 101b
 Hagahos Rebbi Elazar Landau to Yoma 25a
 See Chavos Yair §192, Law 32
 Maharitz Chayes to Yoma 25a
 Maharitz Chajes to Bava Kamma 17b
 To Yoma 25a and Yoma 69b
 Deuteronomy 18:5
 Chiddushei Reb Aryeh Leib, Volume 1, §19
 Maimonides writes (Laws of Kings 2:4) that if a king enters the courtyard and he is of the progeny of David, he should sit. Maimonides does not say, "He is allowed to sit" rather he says, "He should sit." This implies that there is a specific commandment or purpose in a Davidic king sitting in the Temple courtyard.
 Be'er Sheva to Sanhedrin 101b
 To Yoma 8b
 To Sotah 40b
 Furthermore, according to Rabbi Leib Malin, it is difficult to explain why Rashi (to Yoma 5a) writes regarding the Kohen Gadol sleeping in the Holy Temple that the real prohibition is sitting in the courtyard, but one can logically conclude that it applies to sleeping, as well. According to Rabbi Leib Malin, the latter is not a logical assumption based on the first prohibition; rather, it is the same prohibition of needlessly entering the Temple's courtyard as applies by sitting in the courtyard. (Tosafos to Yoma 8b and Chiddushei HaRitva to Yoma 11a also mention this logical sequence.)
 To Maimonides, Laws of Kings §11 (Printed in Kovetz Oraysa by Yeshivas Derech Chaim in memory of Avinoam Grossman, Teves 5767)
 Sotah 41b
 Samuel 2 7:18
 Deuteronomy 29:9
 Tosafos HaRid to Yoma 6a
 Yalkut Shimoni to Samuel §78
 Sotah 41b
 Sotah 41a
 See Deuteronomy 31:10-13
 Sotah 41b