6 Is this how you repay the Lord, you foolish, unwise people? Is he not your father, your Creator? He has made you and established you. 7 Remember the ancient days; bear in mind the years of past generations. Ask your father and he will inform you, your elders, and they will tell you. 8 When the Most High gave the nations their inheritance, when he divided up humankind, he set the boundaries of the peoples, according to the number of the heavenly assembly. 9 For the Lord’s allotment is his people, Jacob is his special possession. 10 The Lord found him in a desolate land, in an empty wasteland where animals howl. He continually guarded him and taught him; he continually protected him like the pupil of his eye.
Berakhot 17aBabylonian Talmud
After his prayer, Rav Safra said the following: May it be Your will, Lord our God, that You establish peace ... in the heavenly entourage [pamalia] of angels each of whom ministers to a specific nation (see Daniel 10), and whose infighting causes war on earth; and in the earthly entourage, the Sages, and among the disciples engaged in the study of Your Torah, whether they engage in its study for its own sake or not for its own sake. And all those engaged in Torah study not for its own sake, may it be Your will that they will come to engage in its study for its own sake.
Notes and References
"... Compared with later versions, this variation of Hanoten Teshua included an angelo-astrological phrase on the rise of the planetary star corresponding to the particular Sar in heaven and lord on earth. What changed between 1655 and the 18th century? Increased anxiety over exoteric references in the kabbalah following the messianic movement of Shabbetai Tsvi, and also, the Enlightenment. However, associations between this prayer and the work of angels (and their associated stars) can be found in works published prior to the Zohar. Moshe Freedman notes the following, “the Gemara reports that after Rav Safra finished praying Shmoneh Esrei (the silent prayer) he would pray ‘for peace in the court above and in the court below’. Rashi (d. 1105) explains on Berakhot 17a that the court above refers to the angels (sarim, singular sar) assigned to each of the non-Jewish nations. When there is discord among the sarim, it generates discord among the nations and vice versa, implying that we should pray for peace between all nations.” ..."
Varady, Aharon N. Hanoten Teshua, The Prayer for the Safety of Kings, Princes, and Commonwealths (pp. 1-5) Open Siddur, 2016