King David’s heart was close to God.
Nevertheless, one day he decides to number the inhabitants of Israel and Judah, something that displeased God. (2 Samuel 24:1, KJV).
David repents, but God, through David’s seer, Gad, gives him the choice of three punishments to choose from: seven years of famine; running from a pursuing enemy for three months; or three days of pestilence. (2 Samuel 24:13, KJV). David decides to put himself in God’s hands rather than men’s and the three days of pestilence begin. (2 Samuel 21:14-15, KJV)
After 70,000 people die of the plague, God says to the destroying angel ready to strike Jerusalem, “Stop. It is enough. Hold off.” (2 Samuel 24:16, KJV, my interpretation)
In a parallel rendition of the story (1 Chronicles 21:15, KJV, ff), David lifts up his eyes and sees the destroying angel suspended between earth and heaven with a drawn sword in his hand ominously stretched out over Jerusalem. (v. 16) He and the elders of Israel are afraid and fall down on their faces. (Ibid.) Ornan (a.k.a. Araunah), owner of the threshingplace near which the angel hovers, and his four sons also see the angel, are afraid, and hide. (v. 20)
David implores the angel to punish him and not the innocent people. (2 Samuel 24:17,KJV)
Then, Gad the seer comes to David and instructs him to erect an altar dedicated to God at the threshingplace (click here for the special significance of threshingplace) in order to stop the plague. (v. 18) He does so and the plague is stopped. (1 Chronicles 21:26-27)
In spite of what must have been an awesome and frightening sight—an angel in the sky with a drawn sword in his hand, ready to continue striking—David addresses the angel. David says to the angel, “Look, it was my fault. Please don’t kill innocent people because of my poor choice.” David doesn’t know at this point in the narrative that God had already changed his mind and decided to stop the plague. (1 Chronicles 21:15, KJV)
Even so, action is still required. David talks to the angel and gets information through his seer, Gad, about what to do. In this case, build an altar on the threshingfloor and sacrifice to God. (1 Chronicles 21: 26, KJV) God accepts the sacrifice and tells the angel to put his sword in its sheath. (1 Chronicles 21:26-27, KJV)
The plague is conclusively stopped.