Satan [the adversary] stood up against Israel and incited David to count [the population of] Israel. So David said to Joab and the leaders of the people, “Go, count Israel from Beersheba to Dan, and bring me their total, so that I may know it.” 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 then does my lord require this? Why will he bring guilt on Israel?” But the king’s word prevailed over Joab. So Joab left and went throughout all Israel and came to Jerusalem. Then Joab gave the total of the census of the people to David. And all Israel were 1,100,000 men who drew the sword; and in Judah 470,000 men who drew the sword. But he did not count Levi and Benjamin among them, because the king’s order was detestable to Joab.
Now God was displeased with this act [of arrogance and pride], and He struck Israel. Then David said to God, “I have sinned greatly because I have done this thing. But now, I beseech You, take away the wickedness and guilt of Your servant, for I have acted very foolishly.”
And the LORD said to Gad, David’s seer, “Go and tell David, saying, ‘Thus says the LORD, “I offer you three choices; choose for yourself one of them, which I will do to you [as punishment for your sin].” ’ ” So Gad came to David and said to him, “Thus says the LORD: ‘Choose for yourself either three years of famine, or three months to be swept away before your enemies, while the sword of your enemies overtakes you, or else three days of the sword of the LORD and plague in the land, and the angel of the LORD bringing destruction throughout all the territory of Israel.’ Now therefore, consider what answer I shall return to Him who sent me.” David said to Gad, “I am in great distress; please let me fall into the hands of the LORD, for His mercies are very great; but do not let me fall into the hand of man.”
So the LORD sent a plague on Israel, and 70,000 men of Israel fell.