Yes, and he was a sinner. As you know, David was not a perfect man. He stole, betrayed his own people to the Philistines, and so on. Nowhere is it said that everything he did was perfect.
With Christ, we are held to a much higher standard.
Not at the cost of sinning. God is more important than...