I'm pretty sure it has a theological origin - it really means "of the devil". You can see these ideas clearly laid out in Milton's Paradise Lost, for example. God has permitted Free Will, because obedience and worship of God are only meaningful if we have the option not to obey or worship. But the exercise of Free Will led to the fall of the rebel angels, who have now become diabolical. But through continued use the phrase has lost most of its intensity, so "diabolical" becomes a mere adjective meaning "outrageous" or "offensive".

Also, the "liberty" part - "taking liberties" meaning behaving with inappropriate informality, in a presumptuous way. So a "liberty" would be an incursion on someone's privacy or dignity.