Appreciating the Government and Praying on its Behalf

The Bible

Seek the welfare of the city wherein I have exiled you, and pray to G-d on its behalf, for with its peace you will have peace. (Jeremiah 29:7)
Fear G-d, my son, and the king; and do not join changers.
(Proverbs 24:21)

The Talmud

Rabbi Chanina, the assistant high priest, said: Pray for the welfare of the government, for if not for the fear of the government one man would swallow the other alive.
(Pirkei Avos 3:2)

Rabbi Shmuel Binyomin Sofer, known as Ksav Sofer (1815-1871)
One of the three oaths which G-d placed upon the Jewish people is not to rebel against the nations. We are obligated to honor them, and to pray for the king and his advisors. We must show appreciation to them for not stopping us from practicing our religion – on the contrary, the government wants every group to continue practicing its own religion.

(\)

Rabbi Moshe Schick, Rabbi of Chust, Hungary (1807-1879) aouther/known as of MaHaram Shik
Taking an oath of office to be loyal to the government under which we live cannot be forbidden, for we are in any case under such a covenant, imposed by G-d when He sent us into exile. He commanded us through Jeremiah (29:7) to seek the welfare of the city where we are exiled. Furthermore, our government defends our lives, and the Gemara says that for this reason we sell them weapons (Avodah Zarah 16a). For the same reason, we are obligated to be loyal to them. Therefore, such an oath of office would not add anything new to this pre-existing oath, and it is permitted, as long as it contains no reference to idols and does not contradict our faith in the coming of the messiah.
(Shailos Utshuvos Maharam Schick, Yoreh Deah 381)

Rabbi Aryeh Leib Zunz, Rabbi of Plotzk, Poland (1768-1833)
The Jewish people says during its exile, “I keep the word of the kings of my host nations, and never rebel against them, because G-d made me take an oath on this matter.” (Based on Ecclesiastes 8:2.) This refers to the oath in the last chapter of Kesubos (111a) that prohibits us from rebelling against the nations. On the contrary, we must always remember and teach our children the statement of our Sages (Berachos 58a), “A kingdom on earth resembles the kingdom in Heaven.” We must be humbly grateful for the kindness and generosity of the leaders of nations, and show our gratitude in all ways possible.
(Melo Haomer commentary on Koheles)

Rabbi Yehuda Aszod, Rabbi of Szerdahely, Hungary (1794-1866)
We are obligated to speak politely to the gentiles and to inquire after their welfare. Even regarding the Egyptians, who were cruel to us and worshipped idols, the Torah says, “Do not despise an Egyptian, for you were a sojourner in his land” (Deuteronomy 23:8). The Torah made this law applicable even when the Jews had their own land and were no longer dependent on Egypt. It applies all the more today, when we are currently in exile under the protection of the gentiles, benefiting from their generosity.
Furthermore, when the Temple was standing, although Jews were independent and did not need the goodwill of the nations, they offered 70 bulls on Succos on behalf of the 70 nations. Even when the Egyptians were drowning in the sea, G-d did not want the angels to sing, because these wicked people were His creations (Megillah 10b). So today, when we live among nations who believe in G-d and keep their Seven Commandments, certainly we are forbidden to hate them. The Talmudic Sages even obligate us to pray on their behalf
(Name of sefer Avos 3:2).