Religion is interesting because it brings out the best and the worst in humanity. It can be a source of good deeds, whether it's people from different spiritual backgrounds coming together to help other people in need after a crisis. But it's also a cause for war and bloodshed.
In the early centuries of Islam, the great schools of Islamic jurisprudence were built upon the above principles. Basic to all their legal systems they developed the doctrine that liberty is the fundamental basis of law.