Before the destruction of the First Temple, God sent the prophet Yirmiyahu to tell the nation and the Kingdom of Judah that their future was dependent on their Shabbat observance:
Thus said the Lord to me: Go and stand in the People’s Gate, by which the kings of Judah enter and by which they go forth, and in all the gates of Jerusalem, and say to them: “Hear the word of the Lord, O kings of Judah, and all Judah, and all the inhabitants of Jerusalem who enter by these gates! Thus said the Lord: Guard yourselves against carrying burdens on the day of Shabbat and against bringing them through the gates of Jerusalem. Nor shall you carry out burdens from your houses on the day of Shabbat, nor do any work. Rather, you shall hallow the day of Shabbat, as I commanded your fathers.”
But they would not listen or turn their ear; they stiffened their necks and would not pay heed or accept discipline.
“If you obey Me” – declares the Lord – “and do not bring in burdens through the gates of this city on the day of Shabbat, and you hallow the day of Shabbat and do no work on it, then through the gates of this city shall enter kings and nobles who sit upon the throne of David, riding on chariots and horses – they, their noblemen, the men of Judah, and the inhabitants of Jerusalem. And this city shall be inhabited for all time. And people shall come from the towns of Judah and from the environs of Jerusalem, and from the land of Benjamin, and from the Shephelah, and from the hill country, and from the Negev, bringing burnt offerings and sacrifices, meal offerings and frankincense, and bringing offerings of thanksgiving to the Temple of the Lord. But if you do not obey My command to hallow the day of Shabbat and to carry in no burdens through the gates of Jerusalem on the Shabbat day, then I will set fire to its gates; it shall consume the palaces of Jerusalem, and it shall not be extinguished.” (Yirmiyahu 17:19-27)
The Sages similarly state: “Jerusalem was destroyed because they desecrated Shabbat within it, as it is written: ‘They have closed their eyes to My Shabbat. I am profaned in their midst’ (Yeĥezkel 22:26)” (Shabbat 119b). Later on it states: “And I sought a man among them to repair the wall or to stand in the breach before Me on behalf of this land, that I might not destroy it; but I found none’” (ibid. 30).