I have read that a Muslim is prohibited from swearing an oath of allegiance to a secular power, e.g., the government of the United States, by specific language in the Quran. On-line references which I have checked seem to be silent on this issue. Is there a definitive answer?
Peace and blessings upon you, I trust that you are well and in good health, the Quran talks abundantly about warning, warnings are set in place against something, for example if you do something wrong, you are warned of a repercussion, a repercussion is something you will be subdued to, a better example if a road sign says drive at 60km per hour and you go 80km per hour you have broken the law of the country and there could very well be a repercussion of a fine that needs to be paid. In my understanding as much as we may not agree on certain laws, you live within a country that has laws, and if you break them there would be repercussions.
For example paying tax, we don’t know what our tax funds, but it’s law that you need to pay it.
I hope I’m making sense here, in the same way if there are warnings that your country has instated - that it needs to be done or there would be severe repercussions you will need to follow them to save yourself and your family from harm.
If you have choices and don’t feel good about doing something, perhaps you shouldn’t and choose another option.
May the Almighty guide us all