Second Samuel closes with a story of sin, judgment, intercession, and worship. The text says Yahweh's anger burned against Israel, and David was moved to count Israel and Judah. Joab objected, asking why the king delighted in this, but he was overruled. After nine months and twenty days, the count was 800,000 fighting men in Israel and 500,000 in Judah.
Then David's heart struck him. He confessed, I have sinned greatly in that which I have done, and asked Yahweh to put away his iniquity. Through Gad the seer, God offered three judgments. David's answer reveals his faith: I am in distress. Let us fall now into Yahweh's hand, for his mercies are great. Let me not fall into man's hand. A pestilence followed, and seventy thousand died. As the angel stretched out his hand over Jerusalem, Yahweh relented and said, It is enough. Now withdraw your hand.
Seeing the angel at the threshing floor of Araunah the Jebusite, David interceded: he had sinned, but what had these sheep done? Let God's hand fall on him and his father's house. Gad directed him to build an altar there. Araunah offered everything freely, but David insisted on paying, saying he would not offer burnt offerings to Yahweh his God which cost him nothing. He bought the threshing floor and oxen for fifty shekels of silver, built an altar, and offered burnt offerings and peace offerings. Yahweh was entreated for the land, and the plague was removed. The book ends with mercy answering repentance and worship.