Satan stood up against Israel, and moved David to number Israel.
"And Satan stood up against Israel, and moved David to number Israel. And David said to Joab and to the princes of the people, Go, number Israel from Beersheba even to Dan; and bring me word that I may know the sum of them.  And Joab said, Jehovah make his people a hundred times as many as they are: but, my lord the king, are they not all my lord's servants? why doth my lord require this thing? why will he be a cause of guilt unto Israel?  Nevertheless the king's word prevailed against Joab.  Wherefore Joab departed, and went throughout all Israel, and came to Jerusalem.  And Joab gave up the sum of the numbering of the people unto David.  And all they of Israel were a thousand thousand and a hundred thousand that drew sword: and Judah was four hundred threescore and ten thousand men that drew sword.  But Levi and Benjamin he counted not among them; for the king's word was abominable to Joab.  And God was displeased with this thing; therefore he smote Israel.  And David said unto God, I have sinned greatly, in that I have done this thing: but now put away, I beseech thee, the iniquity of thy servant; for I have done very foolishly."