according to muslim belief , god grew tired of this perversion of law , and therefore contacted muhammad ( via gabriel ) and handed him the last and perfect legal code that balances the spiritual teachings with the law , and which , therefore , supplants the jewish and christian codes .