So, Judah was guilty of idolatry, including some form of nature worship, and sexual perversion was entrenched. As a result, God at least allowed, if not caused, Egypt to attack. But this attack was a warning shot rather than the end. There were some later reforms and a cleansing of the land by King Asa, and things improved somewhat.