The law is an ass
Said of the application of the law that is contrary to common sense.
This proverbial expression is of English origin and the ass being referred to here is the English colloquial name for a donkey, not the American 'ass', which we will leave behind us at this point. Donkeys have a, somewhat unjustified, reputation for obstinance and stupidity that has given us the adjective 'asinine'. It is the stupidly rigid application of the law that this phrase calls into question.
It is easy to find reference works and websites that attribute the phrase to Charles Dickens, who put it into print in Oliver Twist, 1838. When Mr. Bumble, the unhappy spouse of a domineering wife, is told in court that "...the law supposes that your wife acts under your direction", replies:
"If the law supposes that," said Mr. Bumble, squeezing his hat emphatically in both hands, "the law is a ass - a idiot".
In fact, 'the law is an ass' is from a play published by the English dramatist George Chapman in 1654 - Revenge for Honour:
Ere he shall lose an eye for such a trifle... For doing deeds of nature! I'm ashamed. The law is such an ass.
'Published by' doesn't necessarily mean 'written by'. In 1653, Chapman's play was registered, as The Parricide, or, Revenge for Honor, to fellow playwright Henry Glapthorne. Some scholars contend that the play was the work of neither gentlemen and was written around 1620.
Whoever the author was, we can be sure it wasn't Charles Dickens. However, it was Dickens who brought the phrase to the general public. Oliver Twist was an enormous success when it was first published as a serial and has become one of the world's best selling novels.