2 Samuel 24, How did David sin when the the Lord caused David to number the people?

Question: How did David sin when the the Lord caused David to number the people? Answer: 1 Chronicles 21:1 tells us that Satan moved David to number Israel. So did God or Satan move David? Here is how I understand it: Israel needed to experience judgment for sin, so God removed His protection to allow some judgment, Satan then tempted David, who responded by numbering the people. -PJ