1 Chronicles 21:6-8 New King James Version (NKJV)

6. But he did not count Levi and Benjamin among them, for the king’s word was abominable to Joab.

7. And God was displeased with this thing; therefore He struck Israel.

8. So David said to God, “I have sinned greatly, because I have done this thing; but now, I pray, take away the iniquity of Your servant, for I have done very foolishly.”

1 Chronicles 21