This is the same events from II Samuel 24. In this version, in the very first sentence of I Chronicles 21, It states that Satan moved David to take the census as an act against Israel. David wanted to know how many warriors he had; which was a direct affront to God, who had given David the victory- no matter what the tale of the tape had been in every battle. David had dropped his eyes from the God who had saved him countless times and was concentrating on the world.
One leader's choices affects the whole group, and the enemy knows it. We have to keep our leaders held up in prayer.
With a second lesson being, God's looking for those who have faith in Him and when He finds someone like that and gives us the victory; He takes it pretty personally when we change course and try to figure out how to help ourselves. He even permits the enemy to tempt us.
David assigns the task to Joab, who is not happy. He wants to why and he overtly points out that this will bring guilt to Israel. But he relented and did it, although his own way- and not completely.
God was displeased and struck Israel. He, via Gad the Prophet, gave David three choices of consequences. The way Ezra words it, compared to the way it is described in II Samuel 24, I can see that he is choosing between the sword of man and that of God. He knew and trusted His God.
70,000 died of this pestilence. And as the Angel with the sword, sent by God, approached Jerusalem, God had mercy. David fell on his face and begged to stop killing the people and turn the sword on his family instead.
The angel of the Lord had Gad tell David to build an altar on the threshing floor that was located below the hovering angel. David bought the land, built the altar and offered sacrifices, which the Lord accepted by bring down a consuming fire.
And the Lord commanded the angel, and he put his sword back in its sheath.
I Chronicles 21:27
It's worth noting and remembering all of my days that several events took place from the time Gad gave the order to David until the consuming fire of the Lord accepted David's sacrifice. And only then did the sword go back in the sheath. We have no idea what's going on around us in the spiritual realm. We know what we've been asked to do and how we are supposed to do it, meanwhile being aware of the fact that what we do here affects what happens there.
It's not enough to just do the right things. Other kings would be expected to know the number of their potential warriors. The kind of census would be a normal task; but it's the heart that defiles us and David's heart had strayed from trusting the Lord to trusting himself and the world. It happens like that,--rolling along, head screwed on straight, eyes on Jesus; and then fretting over the checkbook or the medical report.
Heavenly Father- I'm so sorry for my faithless heart. I confess that I often want to know the numbers and fear what may happen if the numbers aren't enough to make me feel secure. I lift up my eyes to hills, but my help comes from you. Maker of heaven and earth and me. May I trust you with my path, and my battles, and even my worship. Come Holy Spirit, Come. I'm sorry I don't make a very good Temple; but by the sacrifice and victory of Jesus, I have your help for the journey. Amen.