So David said to Joab and the commanders of the army, "Go, number Israel, from Beer-sheba to Dan, and bring me a report, so that I may know their number."
But Joab said, "May the LORD increase the number of his people a hundredfold! Are they not, my lord the king, all of them my lord's servants? Why then should my lord require this? Why should he bring guilt on Israel?"
Joab gave the total count of the people to David. In all Israel there were one million one hundred thousand men who drew the sword, and in Judah four hundred seventy thousand who drew the sword.
David said to God, "I have sinned greatly in that I have done this thing. But now, I pray you, take away the guilt of your servant; for I have done very foolishly."
either three years of famine; or three months of devastation by your foes, while the sword of your enemies overtakes you; or three days of the sword of the LORD, pestilence on the land, and the angel of the LORD destroying throughout all the territory of Israel.' Now decide what answer I shall return to the one who sent me."
Then David said to Gad, "I am in great distress; let me fall into the hand of the LORD, for his mercy is very great; but let me not fall into human hands."
And God sent an angel to Jerusalem to destroy it; but when he was about to destroy it, the LORD took note and relented concerning the calamity; he said to the destroying angel, "Enough! Stay your hand." The angel of the LORD was then standing by the threshing floor of Ornan the Jebusite.
David looked up and saw the angel of the LORD standing between earth and heaven, and in his hand a drawn sword stretched out over Jerusalem. Then David and the elders, clothed in sackcloth, fell on their faces.
And David said to God, "Was it not I who gave the command to count the people? It is I who have sinned and done very wickedly. But these sheep, what have they done? Let your hand, I pray, O LORD my God, be against me and against my father's house; but do not let your people be plagued!"
Then the angel of the LORD commanded Gad to tell David that he should go up and erect an altar to the LORD on the threshing floor of Ornan the Jebusite.
David said to Ornan, "Give me the site of the threshing floor that I may build on it an altar to the LORD-- give it to me at its full price-- so that the plague may be averted from the people."
Then Ornan said to David, "Take it; and let my lord the king do what seems good to him; see, I present the oxen for burnt offerings, and the threshing sledges for the wood, and the wheat for a grain offering. I give it all."
But King David said to Ornan, "No; I will buy them for the full price. I will not take for the LORD what is yours, nor offer burnt offerings that cost me nothing."
David built there an altar to the LORD and presented burnt offerings and offerings of well-being. He called upon the LORD, and he answered him with fire from heaven on the altar of burnt offering.