Satan attempted to attack Israel by provoking David to count the Israelites.
David said to Joab and the leaders of the people, "Go, count Israel from Beersheba to Dan. Bring me [the results] so that I may know how many [people] there are."
Joab responded, "May the LORD multiply his people a hundred times over. But, Your Majesty, aren't they all your servants? Why are you trying to do this? Why do you wish to make Israel guilty of [this] sin?"
However, the king overruled Joab. So Joab left, went throughout Israel, and returned to Jerusalem.
Joab reported the census figures to David: In Israel there were 1,100,000 men who could serve in the army, and in Judah there were 470,000 who could serve in the army.
Joab didn't include Levi and Benjamin in the number because he was disgusted with the king's order.
God considered the census to be sinful, so he struck Israel [with a plague].
David said to God, "I have committed a terrible sin by doing this thing. Forgive me because I have acted very foolishly."
The LORD spoke to Gad, David's seer.
"Go and tell David, 'This is what the LORD says: I'm offering you three choices. Choose the one you want me to do to you.'"
When Gad came to David, he said, "This is what the LORD says: 'Take your pick:
either three years of famine, or three months during which your enemies will chase you away when their swords catch up to you, or three days of the LORD's sword--a plague in the land with the Messenger of the LORD destroying the whole country of Israel.' Decide what answer I should give the one who sent me."
"I'm in a desperate situation," David told Gad. "Please let me fall into the LORD's hands because he is extremely merciful. But don't let me fall into human hands."
So the LORD sent a plague on Israel, and 70,000 Israelites died.
God also sent a Messenger to Jerusalem to destroy it, but as he was destroying it, the LORD reconsidered and changed his mind about the disaster. "Enough!" he said to the destroying Messenger. "Put down your weapon." The Messenger of the LORD was standing by the threshing floor of Ornan the Jebusite.
When David looked up, he saw the Messenger of the LORD standing between heaven and earth. The Messenger had a sword in his hand and stretched it over Jerusalem. David and the leaders were dressed in sackcloth. They bowed down with their faces touching the ground.
David said to God, "I'm the one who ordered the people to be counted. I am the one who sinned and did wrong. What have these sheep done? LORD my God, let your punishment be against me and my father's family, but don't punish your people with a plague."
The LORD's Messenger told Gad to tell David to go and set up an altar for the LORD at Ornan the Jebusite's threshing floor.
David went as Gad had told him in the LORD's name.
Now, Ornan had turned around and seen the Messenger. Ornan's four sons who were with him hid, but Ornan kept on threshing the wheat.
When David arrived, Ornan looked up and saw him. So he left the threshing floor and bowed down with his face touching the ground in front of David.
David said to Ornan, "Let me have the land this threshing floor is on. I'll build an altar for the LORD on it. Sell it to me for the full price. Then the plague on the people will stop."
Ornan said to David, "Take it, Your Majesty, and do whatever you think is right. I'll give you oxen for the burnt offering, threshers for firewood, and wheat for the grain offering. I'll give you everything."
"No," King David told Ornan, "I insist on buying it for the full price. I won't take what is yours for the LORD and offer burnt sacrifices that cost me nothing."
So David gave Ornan 15 pounds of gold for that place.
David built an altar for the LORD there and sacrificed burnt offerings and fellowship offerings. He called on the LORD, and the LORD answered him by [sending] fire from heaven on the altar for burnt offerings.
So the LORD spoke to the Messenger, and he put his sword back in its scabbard.
At that time, when David saw the LORD had answered him at the threshing floor of Ornan the Jebusite, he offered sacrifices there.
The LORD's tent that Moses made in the desert and the altar for burnt offerings were at the worship site at Gibeon.
However, David couldn't go there to consult God because he was frightened by the sword of the LORD's Messenger.