Similar to the instructions we pass along to our children for their physical safety, our Father in heaven gives us His instruction for our spiritual safety. Yet like ignorant and carefree children, we at times ignore His teaching. We at times want to do things according to our own estimation apart from the Scriptures. And when we do this, God in His mercy allows us to feel pain. Guilt is a gift from God that makes us sensitive to sin. Another word for this that we commonly use is conviction.
Randy Smith