1 Chronicles 21:1–8
Satan rose up against Israel and caused David to take a census of the people of Israel. 2 So David said to Joab and the commanders of the army, “Take a census of all the people of Israel—from Beersheba in the south to Dan in the north—and bring me a report so I may know how many there are.”
3 But Joab replied, “May the Lord increase the number of his people a hundred times over! But why, my lord the king, do you want to do this? Are they not all your servants? Why must you cause Israel to sin?”
4 But the king insisted that they take the census, so Joab traveled throughout all Israel to count the people. Then he returned to Jerusalem 5 and reported the number of people to David. There were 1,100,000 warriors in all Israel who could handle a sword, and 470,000 in Judah. 6 But Joab did not include the tribes of Levi and Benjamin in the census because he was so distressed at what the king had made him do.
7 God was very displeased with the census, and he punished Israel for it. 8 Then David said to God, “I have sinned greatly by taking this census. Please forgive my guilt for doing this foolish thing.”