David made many mistakes, to be sure. Some of his failures were worthy of an end to his monarchy. Other Kings died for less. So why was David allowed to continue as King? And why is he considered the greatest King of Israel to this day?
Under David, the nation is united. This loosely federated set of 12 or more tribes was united under his reign- no small feat considering Israel was divided longer than it was ever united. More importantly he returns the ark of the Covenant to Jersusalem and there establishes the seat of the temple – later to be built by his son Solomon.
These two feats, along with his military accomplishments, were the greatest achievements of his career. Many Kings followed him, but few were able to make these unifying acheivements.