Again the anger of the Lord was aroused against Israel, and He moved David against them to say, "Go, number Israel and Judah."
So the king said to Joab the commander of the army who was with him, "Now go throughout all the tribes of Israel, from Dan to Beersheba, and count the people, that I may know the number of the people."
And Joab said to the king, "Now may the Lord your God add to the people a hundred times more than there are, and may the eyes of my lord the king see it. But why does my lord the king desire this thing?"
Nevertheless the king's word prevailed against Joab and against the captains of the army. Therefore Joab and the captains of the army went out from the presence of the king to count the people of Israel.
And they crossed over the Jordan and camped in Aroer, on the right side of the town which is in the midst of the ravine of Gad, and toward Jazer.
Then they came to Gilead and to the land of Tahtim Hodshi; they came to Dan Jaan and around to Sidon;
and they came to the stronghold of Tyre and to all the cities of the Hivites and the Canaanites. Then they went out to South Judah as far as Beersheba.
So when they had gone through all the land, they came to Jerusalem at the end of nine months and twenty days.
Then Joab gave the sum of the number of the people to the king. And there were in Israel eight hundred thousand valiant men who drew the sword, and the men of Judah were five hundred thousand men.
And David's heart condemned him after he had numbered the people. So David said to the Lord, "I have sinned greatly in what I have done; but now, I pray, O Lord, take away the iniquity of Your servant, for I have done very foolishly."
Now when David arose in the morning, the word of the Lord came to the prophet Gad, David's seer, saying,
"Go and tell David, 'Thus says the Lord: "I offer you three things; choose one of them for yourself, that I may do it to you." ' "
So Gad came to David and told him; and he said to him, "Shall seven years of famine come to you in your land? Or shall you flee three months before your enemies, while they pursue you? Or shall there be three days' plague in your land? Now consider and see what answer I should take back to Him who sent me."
References for 2 Samuel 24:13
And David said to Gad, "I am in great distress. Please let us fall into the hand of the Lord, for His mercies are great; but do not let me fall into the hand of man."
So the Lord sent a plague upon Israel from the morning till the appointed time. From Dan to Beersheba seventy thousand men of the people died.
And when the angel stretched out His hand over Jerusalem to destroy it, the Lord relented from the destruction, and said to the angel who was destroying the people, "It is enough; now restrain your hand." And the angel of the Lord was by the threshing floor of Araunah the Jebusite.
References for 2 Samuel 24:16
Then David spoke to the Lord when he saw the angel who was striking the people, and said, "Surely I have sinned, and I have done wickedly; but these sheep, what have they done? Let Your hand, I pray, be against me and against my father's house."
And Gad came that day to David and said to him, "Go up, erect an altar to the Lord on the threshing floor of Araunah the Jebusite."
So David, according to the word of Gad, went up as the Lord commanded.
Now Araunah looked, and saw the king and his servants coming toward him. So Araunah went out and bowed before the king with his face to the ground.
Then Araunah said, "Why has my lord the king come to his servant?" And David said, "To buy the threshing floor from you, to build an altar to the Lord, that the plague may be withdrawn from the people."
Now Araunah said to David, "Let my lord the king take and offer up whatever seems good to him. Look, here are oxen for burnt sacrifice, and threshing implements and the yokes of the oxen for wood.
All these, O king, Araunah has given to the king." And Araunah said to the king, "May the Lord your God accept you."
Then the king said to Araunah, "No, but I will surely buy it from you for a price; nor will I offer burnt offerings to the Lord my God with that which costs me nothing." So David bought the threshing floor and the oxen for fifty shekels of silver.
And David built there an altar to the Lord, and offered burnt offerings and peace offerings. So the Lord heeded the prayers for the land, and the plague was withdrawn from Israel.