The books of 1 and 2 Samuel describe Israel's transition from being ruled by judges to having a king. God chooses David to succeed Saul as king because he will exercise power righteously and depend fully on God with obedience to his commands, unlike Saul. David trusts in God and defeats Goliath, demonstrating he has the heart of a king. God establishes an everlasting covenant with David and while David sins, his heart ultimately belongs to God.