Satan stands against Israel and incites David to number the people. David orders Joab and the commanders to count Israel from Beersheba to Dan. Joab asks why he wants to do it and why bring guilt on Israel, but the king's order prevails. Joab counts all the people, but does not include Levi or Benjamin, because the king's command was abhorrent to him. The result is one million one hundred thousand men who draw the sword in Israel, and four hundred seventy thousand in Judah.
This displeases God, and he strikes Israel. David acknowledges that he has sinned greatly and begs the Lord to take away his guilt. The prophet Gad gives him three options: three years of famine, three months of fleeing before his enemies or three days of the sword of the Lord, that is, pestilence. David chooses to fall into the hand of the Lord, whose mercy is very great, and not into the hand of men. The Lord sends pestilence on Israel and seventy thousand die. When the angel is about to destroy Jerusalem, the Lord relents of the disaster and tells the angel to stay his hand. The angel is standing by the threshing floor of Ornan the Jebusite.
David sees the angel between earth and heaven with a drawn sword stretched out over Jerusalem, and he and the elders fall on their faces in sackcloth. David prays that he is the one who sinned and asks that the hand of the Lord be against him and his house, but not against the people. The angel of the Lord commands Gad to tell David to raise an altar on the threshing floor of Ornan. Ornan offers to give him everything, but David insists on paying the full amount, because he will not offer to the Lord what costs him nothing. He builds the altar there, offers burnt offerings and peace offerings, the Lord answers with fire from heaven and commands the angel to put his sword back.