The problem was idolatry; the result was God's judgment; the goal is our repentance and acknowledgment of God as Sovereign Lord.