2 Samuel 24:10

10 But afterward, David was stricken to the heart because he had numbered the people. David said to the Lord, "I have sinned greatly in what I have done. But now, O Lord, I pray you, take away the guilt of your servant; for I have done very foolishly."

2 Samuel 24:10 In-Context

8 So when they had gone through all the land, they came back to Jerusalem at the end of nine months and twenty days.
9 Joab reported to the king the number of those who had been recorded: in Israel there were eight hundred thousand soldiers able to draw the sword, and those of Judah were five hundred thousand.
10 But afterward, David was stricken to the heart because he had numbered the people. David said to the Lord, "I have sinned greatly in what I have done. But now, O Lord, I pray you, take away the guilt of your servant; for I have done very foolishly."
11 When David rose in the morning, the word of the Lord came to the prophet Gad, David's seer, saying,
12 "Go and say to David: Thus says the Lord: Three things I offer you; choose one of them, and I will do it to you."
New Revised Standard Version Bible, copyright 1989, Division of Christian Education of the National Council of the Churches of Christ in the United States of America. Used by permission. All rights reserved.