When David arose in the morning, the word of the LORD came to the prophet Gad, David's seer, saying, "Go and speak to David, 'Thus the LORD says, "I am offering you three things; choose for yourself one of them, which I will do to you."'" read more.
So Gad came to David and told him, and said to him, "Shall seven years of famine come to you in your land? Or will you flee three months before your foes while they pursue you? Or shall there be three days' pestilence in your land? Now consider and see what answer I shall return to Him who sent me." Then David said to Gad, "I am in great distress. Let us now 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 pestilence upon Israel from the morning until the appointed time, and seventy thousand men of the people from Dan to Beersheba died. When the angel stretched out his hand toward Jerusalem to destroy it, the LORD relented from the calamity and said to the angel who destroyed the people, "It is enough! Now relax your hand!" And the angel of the LORD was by the threshing floor of Araunah the Jebusite. Then David spoke to the LORD when he saw the angel who was striking down the people, and said, "Behold, it is I who have sinned, and it is I who have done wrong; but these sheep, what have they done? Please let Your hand be against me and against my father's house." So Gad came to David that day and said to him, "Go up, erect an altar to the LORD on the threshing floor of Araunah the Jebusite." David went up according to the word of Gad, just as the LORD had commanded.
NASB