Then Satan stood up against Israel and moved David to number Israel. So 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 their number.” Joab said, “May the LORD add to His people a hundred times as many as they are! But, my lord the king, are they not all my lord’s servants? Why does my lord seek this thing? Why should he be a cause of guilt to Israel?” Nevertheless, the king’s word prevailed against Joab. Therefore, Joab departed and went throughout all Israel, and came to Jerusalem. Joab gave the number of the census of all the people to David. And all Israel were 1,100,000 men who drew the sword; and Judah was 470,000 men who drew the sword. But he did not number Levi and Benjamin among them, for the king’s command was abhorrent to Joab.
God was displeased with this thing, so He struck Israel. David said to God, “I have sinned greatly, in that I have done this thing. But now, please take away the iniquity of Your servant, for I have done very foolishly.”