The Oxford Dictionary of Word Origins asserts that "[t]he idea of a necessary evil goes back to Greek", describing the first necessary evil as marriage, and further stating that, "The first example in English, from 1547, refers to a woman".
[1] Thomas Fuller, in his 1642 work, The Holy State and the Profane State, made another of the earliest recorded uses of the phrase when he described the court jester as something that "...some count a necessary evil in a Court".
[2] In Common Sense, Thomas Paine described government as at best a "necessary evil".
Where an author suggests that "[p]aperwork is a necessary evil, despised but handled with the understanding that a mistake – even a trivial one – could be costly".
[6] It is understood that the author is not deeming "paperwork" to be wicked, immoral, or evil in senses comparable to those.
We are involved in a vicious circle from which there is no escape except in the denial of one premiss [sic] or of the other.
They would certainly say that it was wrong to charge a man with evil conduct who had done only what it was impossible for him to avoid doing.