King David was one of the greatest military leaders and most passionate followers of God in history. He is described as a man after God's heart and it's evident from his writings (read the book of Psalms.) He was not a man without flaw however. He was imperfectly human (like us) and made poor choices in several areas of his life in spite of his devotion to God.
There is one particular instance that stands out above others. David stayed behind at his palace while his army went out to battle and he found himself on his roof staring at a woman bathing. He continued his poor choices by bringing her to his home, committing adultery, and then arranging to have her husband killed. He thought that he had gotten away with it (she obviously wasn't going to say anything) and married her thinking his life was fine. David allowed his tremendous ego and sense of entitlement to remove him from God's protection and blessing.
God had chosen David as a young shepherd boy and anointed him as king. He had given him victory over his enemies, blessed him with tremendous riches, and set up his kingdom to rule over all. God even told David that his legacy would last forever--that the salvation of God's people would come through his lineage. With all of these things David still chose to sin. God's words to him after confronting him were, "And if all this had been too little, I would have given you even more."
That is God's truth in the middle of our own selfish dilemma and what I think is the root of our sin. We choose to sin because we want more--more pleasure, power, possessions, influence, entitlement. What we find is that our version of "more" doesn't satisfy. We struggle with the choice, but it truly only makes sense to seek abundance from a perfect, generous King.
It's only when we find satisfaction in what God is offering that we can truly be at peace.