"But when Rehoboam was firmly established and strong, he abandoned the Law of the Lord, and all Israel followed him in this sin." 2 Chronicles 12:1
After Solomon died, the rule of Israel passed to his son, Rehoboam. Rehoboam took steps to fortify all the cities around him. After doing that he thought he had all the protection he needed. As a result, from the verse we just read, he abandoned the Lord. He apparently had an attitude that said, "God, I will call on you only if I need you, but when my strength is adequate I will protect myself and leave you behind." As a result of this attitude, God stirred up the Egyptians (under their King Shishak) to conquer those "fortified" cities. As the Egyptians prepared to attack Jerusalem the prophet Shemaiah told Rehoboam "This is what the Lord says: You have abandoned me, so I am abandoning you to Shishak."
Fortunately Rehoboam humbled himself at this point instead of hardening his heart and God responded to that attitude change. But He did an interesting thing. He still allowed the Egyptians to conquer Jerusalem and He said "Since the people have humbled themselves, I will not completely destroy them...But they will become his (Shishak's) subjects, so they will know the difference between serving me and serving earthly rulers."
I think we need to be on guard within our own hearts to remember whom we truly serve and who watches out for us. We can easily mistake the peace, protection and provision that we have experienced as coming from our own work when God truly is the source of all these.