It is Haram (prohibited) to
swear by other than Allah, such as swearing by one’s father or chief, or by the honor or glory of someone, or anything similar, for it is authentically reported that the Prophet (peace be upon him) said,
“Anyone who has to take an oath should swear by Allah or else remain silent.”
(Agreed upon by Al-Bukhary and Muslim).
He also said,
“Anyone who has to take an oath should only swear by Allah.”
And he (peace be upon him) said,
“Anyone who swears by other than Allah has committed Shirk (associated others in worship with Allah).”
Muslims should not equate Allah with anything else, such as one’s country, king, or chief, when making a pledge to serve them. (Part No. 1; Page No. 353) They should say instead: “I vow by Allah, to do my best to fulfill my duty towards Allah Alone; and then to serve my country and help people; and to act upon the scout law, as long as it does not contradict the Law of Allah (Exalted be He).”
Actions must always be done in accordance with the Law of Allah (Exalted be He); therefore, it is not permissible to make a pledge to absolutely obey the laws of a certain state, sect, or a group of people.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.