David saw the different kinds of sacrifices offered to God as being far beyond mere religious rituals. It is true that they expressed faith and obedience to the Laws of Moses.
However, David also had discernment that such sacrifices, throughout Israel’s history, had deviated from the principles of intelligent faith. It is because of the sacrifices, which were so traditional, became meaningless obligations. For this reason, during the most distressful moments of his life, he said in other words: If the Lord were pleased by burnt offerings and sacrifices, I would offer as much as the Lord would like. But, no. The sacrifices the Lord wants are a broken spirit; a broken and contrite heart. These You shall not despise, O God. (Psalm 51.16-17)
From then on, David prays for the wellbeing of Zion and for building the walls of Jerusalem. (Psalm 51.18).
In truth, he is begging, not only for Zion and Jerusalem, but also for himself, because as long as his life is not restored by God’s forgiveness and the “walls of his life” are not built up (sincere repentance), there shall be no righteous offerings to please the LORD. What good is a sacrifice, when the offering giver is in sin?
David had a clear understanding of the kind of sacrifice the LORD desired. The offering of sacrifice only had and has value (is righteous) when the offering giver is righteous.
Then You shall be pleased with the sacrifices of righteousness, with burnt offerings and whole burnt offering; then they shall offer bulls on Your Altar. Psalm 51.19