Can I enter into a contractual agreement with British citizens to sell them guns?
Nothing in what the guy is saying suggests that you can write a contract that legalizes something otherwise prohibited.
If you want to write a will, for example, that follows Sharia law and gives the boys everything and gives nothing to the girls unless they marry their buddy's third uncle, then go right ahead.
If you want to cut your brother's hand off because he looked at your wife funny...no.