Your magic is tied to belief, and your belief is tied to a code of behavior. You must follow your ethos, or your magic fails. It does not matter if you follow a god or a philosophy; what matters is that your ethos and tenets are central to all that you do.
This is the basis of all divine magic; if your god actually grants you these powers, or if your faith is just a psychological crutch you use to work your magic is an open issue. Even Moses worked a miracle without the direct approval of the lord, but in the end he was condemned for it.
Each magical act must be a manifestation of the power of your belief. You cannot work magic unless it is somehow a result of divine action. Your magic cannot work contrary to your code of ethics, and if you grossly violate the tenets of your religion at any time, you lose your ability to work magic until you atone.
Most religion have a built-in antithesis; there are opposing gods, devils, the dark side and other negative, opposed forces in most mythologies. If you fall from the path of righteousness, you can usually pick up and continue your studies under a new master, but this will mandate a drastic change in role and personality, and may turn you into an NPC.