This is an attack to hypocrisy, on those who cover up their evil-doing by quoting passages from the Bible or Qur’an. The proverb comes from Shakespeare’s The Merchant of Venice:
The devil can cite Scripture for his purpose.
An evil soul, producing holy witness,
Is like a villain with a smiling cheek,
A goodly apple, rotten at the heart:
Oh, what a goodly outside falsehood hath!
The following, from Richard III, also applies:
But than I sight; and, with a piece of Scripture,
Tell them that God bids us do good for evil:
And thus I clothe by naked villainy
With old odd ends, stolen out of holy writ;
And seems a saint, when most I play the devil.