1 Chronicles 21:8-18

8 David said to God, "I have committed a terrible sin in doing this! Please forgive me. I have acted foolishly."
9 Then the Lord said to Gad, David's prophet,
10 "Go and tell David that I am giving him three choices. I will do whichever he chooses."
11 Gad went to David, told him what the Lord had said, and asked, "Which is it to be?
12 Three years of famine? Or three months of running away from the armies of your enemies? Or three days during which the Lord attacks you with his sword and sends an epidemic on your land, using his angel to bring death throughout Israel? What answer shall I give the Lord?"
13 David replied to Gad, "I am in a desperate situation! But I don't want to be punished by people. Let the Lord himself be the one to punish me, because he is merciful."
14 So the Lord sent an epidemic on the people of Israel, and seventy thousand of them died.
15 Then he sent an angel to destroy Jerusalem, but he changed his mind and said to the angel, "Stop! That's enough!" The angel was standing by the threshing place of Araunah, a Jebusite.
16 David saw the angel standing in midair, holding his sword in his hand, ready to destroy Jerusalem. Then David and the leaders of the people - all of whom were wearing sackcloth - bowed low, with their faces touching the ground.
17 David prayed, "O God, I am the one who did wrong. I am the one who ordered the census. What have these poor people done? Lord, my God, punish me and my family, and spare your people."
18 The angel of the Lord told Gad to command David to go and build an altar to the Lord at Araunah's threshing place.
Scripture taken from the Good News Translation - Second Edition, Copyright 1992 by American Bible Society. Used by Permission.