2 Chronicles 12:2

And it came to pass, that in the fifth year of king Rehoboam Shishak king of Egypt came up against Jerusalem, because they had transgressed against the LORD,

In the fifth year of King Rehoboam, Shishak king of Egypt came up against Jerusalem because they had transgressed against the Lord. The invasion was God's judgment for apostasy after forsaking Him, resting upon both the ruler and the people. God declared that He had left them in Shishak's hands.

The losses brought the people to recognize God's hand in what had befallen them and to humble themselves, with Rehoboam and the princes of Judah humbling themselves and acknowledging that the Lord is righteous. God then withheld total destruction and granted deliverance, yet left them as servants subject to Egypt. They were thus to learn the difference between serving Him and serving earthly kingdoms.