Satan rose up against Israel and incited David to take a census of Israel.
References for 1 Chronicles 21:1
So David said to Joab and the commanders of the troops, “Go and count the Israelites from Beersheba to Dan. Then report back to me so that I may know how many there are.”
References for 1 Chronicles 21:2
But Joab replied, “May the LORD multiply his troops a hundred times over. My lord the king, are they not all my lord’s subjects? Why does my lord want to do this? Why should he bring guilt on Israel?”
References for 1 Chronicles 21:3
The king’s word, however, overruled Joab; so Joab left and went throughout Israel and then came back to Jerusalem.
Joab reported the number of the fighting men to David: In all Israel there were one million one hundred thousand men who could handle a sword, including four hundred and seventy thousand in Judah.
References for 1 Chronicles 21:5
But Joab did not include Levi and Benjamin in the numbering, because the king’s command was repulsive to him.
This command was also evil in the sight of God; so he punished Israel.