8 And again, David, after he had commanded the people to be numbered, was smitten in heart, and said to the Lord: “I have sinned exceedingly, because I have commanded this, and now, O Lord, take away the iniquity of Your servant, for I have transgressed exceedingly.” And the prophet Nathan was sent again to him, to offer him the choice of three things, that he should select the one he chose— famine in the land for three years, or that he should flee for three months before his enemies, or mortal pestilence in the land for three days. And David answered: “These three things are a great strait to me, but let me fall into the hand of the Lord, for very many are His mercies, and let me not fall into the hands of man.” Now his fault was that he desired to know the number of the whole of the people which was with him, which knowledge he ought to have left to God alone.
Source: Letters (New Advent)