Negative commandment · Lo Ta’aseh #316 of 613
Not to curse a nasi - i.e., the king or the head of the academy in Eretz Yisrael
שלא לקלל הנשיא, והוא המלך או ראש ישיבת ארץ ישראל
The verse · Shemot 22:27
אֱלֹהִים לֹא תְקַלֵּל וְנָשִׂיא בְעַמְּךָ לֹא תָאֹר
“Thou shalt not revile the judges, nor curse the ruler of thy people.”
The Rambam’s words
Not to curse a nasi - i.e., the king or the head of the academy in Eretz Yisrael - as [Exodus, ibid.] continues: "...and do not curse the nasi of your people."
שלא לקלל הנשיא, והוא המלך או ראש ישיבת ארץ ישראל, שנאמר "ונשיא בעמך, לא תאור" (שמות כב,כז).
Why · Sefer HaChinuch #71
To not curse a chieftain (nassi)
“It is from the roots of the commandment that it is because it is impossible for the settlement of people without their making one of them head over the others, to do his command and fulfill his decrees.”
Who & when
“And it is practiced by males and females in the Land and in every place that we are with our king or with the head of the Great Sanhedrin.”
Where in the Mishneh Torah
Hilchot The Sanhedrin and the Penalties within Their Jurisdiction הלכות סנהדרין והעונשין המסורין להם