1 Chronicles 21 :16,17 (KJV)
16 And David lifted up his eyes, and saw the angel of the Lord stand between the earth and the heaven, having a drawn sword in his hand stretched out...
What We Think Is Good, God May Think Otherwise
What David had Joab do, Joab knew in the back of his mind that it was wrong and God would not be happy with it.