1 Kings 15:5
Because David did that which was right in the eyes of the LORD, and turned not aside from any thing that he commanded him all the days of his life, save only in the matter of Uriah the Hittite. Because David did that which was right in the eyes of the LORD, and turned not aside from any thing that he commanded him all the days of his life, save only in the matter of Uriah the Hittite.
The verse belongs to the history of Judah's kings in chapters 12-16 after the division of the kingdom into Judah and Israel. Within that history it touches Abijam's brief wicked reign and Asa's better reign and prosperity.
It commends David as having done what was right in the Lord's sight and kept God's commands all the days of his life, with only the matter of Uriah the Hittite excepted. That lifelong course shows he was not habitually disobedient, even though he was a warrior. It also upholds calling him a man after God's own heart.
By naming only Uriah, it teaches that in that great sin toward Uriah his heart was turned aside, while otherwise his heart was to do right, although he made many mistakes including the wrongful numbering of Israel. The exception does not deny his plurality of wives and concubines nor his numbering of Israel from ambition to show how Israel had increased. Those failures were of a different kind, for he did right as far as he saw, as Abraham and Jacob also did not see all things. They were done where there was no expressed command forbidding them or where duty had not been clearly brought before him so that he understood it, and even the numbering he himself did not clearly see as wrong. Whenever the Lord told him to do anything he did it, and where he clearly saw his duty he did it, whereas the matter of Uriah was flagrant, open wickedness directly contrary to the command of God.
The real test of his loyalty was taking reproof and ever submitting to God when he had done wrong and was reproved. Whenever God reproved him and pointed out his wrong course he repented and humbled himself and did what God asked. His heart was to do right, and God accepted him because of his fulness of purpose. God excuses failures done in ignorance because He knows the heart and has overlooked many failures of His servants in the past, though men can never excuse their own sin from ignorance.
His heart was perfect, and that is why he is described as a man after God's own heart, even though his life record is marred with mistakes and sins. In the matter of Uriah the Hittite he committed the terrible sins of murder and adultery that brought blood-guiltiness upon him. That sin was great and grievous and gave great occasion to the enemies of the Lord to blaspheme, so that infidels ever since have pointed to it to assail David's character and to reject the Bible and the plan of redemption.
God showed mercy and pardoned David when he met the conditions, and placed that pardon on record. That recorded pardon proves that the plan of salvation is for pardoning sin and covers all manner of sins except the sin against the Holy Ghost. To find fault with God for pardoning David is to find fault with the plan of salvation itself. Sinners who see the exceeding sinfulness of their sins should be thankful for that mercy, rejoice in it, hope in it, and avail themselves of it before it is too late.
His obedience in not turning aside from God's commands is held up as the pattern for those who will reign with Christ. Those who overcome are promised a place with Christ on His throne, after they have been tested and shown trustworthy with the interests of God's kingdom. His example, especially while a young man, should inspire higher ambitions and greater efforts and remains well worthy of following. As a young man he conquered lions and bears and giants, and those victories picture victory by modern youth over enemies like bad companions, bad books, and intemperance. His greater trials came later with his position as companion of the king, leader in the army, and king of Israel, bringing trials and temptations he was not always able to meet.