Satan rose up against Israel and caused David to take a census of the Israelites.
David gave these orders to Joab and his commanders: "Take a census of all the people in the land -- from Beersheba in the south to Dan in the north -- and bring me the totals so I may know how many there are."
But Joab replied, "May the LORD increase the number of his people a hundred times over! But why, my lord, do you want to do this? Are they not all your servants? Why must you cause Israel to sin?"
But the king insisted that Joab take the census, so Joab traveled throughout Israel to count the people. Then he returned to Jerusalem
and reported the number of people to David. There were 1,100,000 men of military age in Israel, and 470,000 in Judah.
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.
God was very displeased with the census, and he punished Israel for it.
Then David said to God, "I have sinned greatly and shouldn't have taken the census. Please forgive me for doing this foolish thing."
Then the LORD spoke to Gad, David's seer. This was the message:
"Go and say to David, 'This is what the LORD says: I will give you three choices. Choose one of these punishments, and I will do it.'"
So Gad came to David and said, "These are the choices the LORD has given you.
You may choose three years of famine, three months of destruction by your enemies, or three days of severe plague as the angel of the LORD brings devastation throughout the land of Israel. Think this over and let me know what answer to give the LORD."
"This is a desperate situation!" David replied to Gad. "But let me fall into the hands of the LORD, for his mercy is very great. Do not let me fall into human hands."
So the LORD sent a plague upon Israel, and seventy thousand people died as a result.
And God sent an angel to destroy Jerusalem. But just as the angel was preparing to destroy it, the LORD relented and said to the death angel, "Stop! That is enough!" At that moment the angel of the LORD was standing by the threshing floor of Araunah the Jebusite.
References for 1 Chronicles 21:15
David looked up and saw the angel of the LORD standing between heaven and earth with his sword drawn, stretched out over Jerusalem. So David and the leaders of Israel put on sackcloth to show their distress and fell down with their faces to the ground.
And David said to God, "I am the one who called for the census! I am the one who has sinned and done wrong! But these people are innocent -- what have they done? O LORD my God, let your anger fall against me and my family, but do not destroy your people."
Then the angel of the LORD told Gad to instruct David to build an altar to the LORD at the threshing floor of Araunah the Jebusite.
So David obeyed the instructions the LORD had given him through Gad.
Araunah, who was busy threshing wheat at the time, turned and saw the angel there. His four sons, who were with him, ran away and hid.
When Araunah saw the king approaching, he left his threshing floor and bowed to the ground before David.
David said to Araunah, "Let me buy this threshing floor from you at its full price. Then I will build an altar to the LORD there, so that he will stop the plague."
"Take it, my lord, and use it as you wish," Araunah said to David. "Here are oxen for the burnt offerings, and you can use the threshing tools for wood to build a fire on the altar. And take the wheat for the grain offering. I will give it all to you."
But the king replied to Araunah, "No, I insist on paying what it is worth. I cannot take what is yours and give it to the LORD. I will not offer a burnt offering that has cost me nothing!"
So David gave Araunah six hundred pieces of gold in payment for the threshing floor.
References for 1 Chronicles 21:25
David built an altar there to the LORD and sacrificed burnt offerings and peace offerings. And when David prayed, the LORD answered him by sending fire from heaven to burn up the offering on the altar.
Then the LORD spoke to the angel, who put the sword back into its sheath.
When David saw that the LORD had answered his prayer, he offered sacrifices there at Araunah's threshing floor.
At that time, the Tabernacle of the LORD and the altar that Moses made in the wilderness were located at the hill of Gibeon.
But David was not able to go there to inquire of God, because he was terrified by the drawn sword of the angel of the LORD.