Allah Almighty has given us in the Quran an example of the wife of Noah and the wife of Lot, both of whom were under two of our righteous servants but betrayed them. They did not avail them against Allah at all, and it was said, "Enter the Fire with those who enter."
And when Noah prayed to Allah, "My Son, come aboard with us and be not with the disbelievers. Noah's son replied, "I will take refuge on a mountain to protect me from the water." Noah said, "There is no protector today from the decree of Allah, except for whom He gives mercy." And the waves came between them, and Noah's son was among the drowned. When Noah called to his Lord, Allah said, "O Noah, indeed, he is not of your family; indeed, he is one whose work was other than righteous, so ask not of Me that of which you have no knowledge."
And Ibrahim, when he disowned his father and his people, he said, "Indeed, I am free of what you worship, except for the one who created me; indeed, He will guide me."
This is the matter of loyalty and disavowal, as stated by the Prophet Muhammad: "The family of so-and-so are not my allies; indeed, my allies are only the righteous." The matter of loyalty and disavowal is one of the foundational beliefs that cannot be compromised or tarnished; it is a matter agreed upon by the prophets until the Day of Resurrection.
For this reason, Allah has promised punishment for those who befriend the enemies of Allah. He said, "Give tidings to the hypocrites that there will be for them a painful punishment, those who take disbelievers as allies instead of the believers. Do they seek with them honor? But indeed, honor belongs to Allah entirely." O you who have believed, do not take the Jews and the Christians as allies. They are allies of one another. And whoever is an ally to them among you, then indeed, he is one of them. Indeed, Allah guides not the wrongdoing people." Those whose hearts are diseased hasten to protect the disbelievers, fearing that a trial may strike them. And Allah will bring about the victory or a decision from Him, and they will become, over what they have been concealing within themselves, regretful.
Therefore, those who follow the path of the prophets should base their loyalty on faith and the principle of the Oneness of Allah.