Moses himself warned the Israelites of the consequences of being unfaithful to God in the Promised Land. Even he foretold Israel’s failure and rebellion. (Deuteronomy 31:15-18, 20-21, 29; 32:15-38.)
God warned Solomon when he dedicated the Temple 1 Kings 9:1-9.
‘But if you or your descendants turn away from me and do not observe the commands and decrees I have given you and go off to serve other gods and worship them, then I will cut off Israel from the land I have given them and will reject this temple I have consecrated for my Name. Israel will then become a byword and an object of ridicule among all peoples. This temple will become a heap of rubble.’ (1 Kings 9:6-8)
The Northern Kingdom of Israel was overrun by the Assyrians 722 BC.
Isaiah (740-700 BC) and Micah and later Jeremiah (621-580 BC) warned the Southern Kingdom of Judah but the Israelites did not listen.
The sins of King Manasseh brought God’s judgment 2 Kings 21:10-15
Nevertheless, the LORD did not turn away from the heat of his fierce anger, which burned against Judah because of all that Manasseh had done to arouse his anger. So the LORD said, ‘I will remove Judah also from my presence as I removed Israel, and I will reject Jerusalem, the city I chose, and this temple, about which I said, “My Name shall be there. (2 Kings 23:26-27)
Even the reforms of good King Josiah could not save the Southern Kingdom of Judah. King Nebuchadnezzar of Babylon besieged Jerusalem taking King Jehoiachin and Daniel into captivity in 597 BC. The Babylonians invaded Jerusalem and destroyed the Temple and all the remaining Israelites were taken into Exile in 587 BC. (2 Kings 25)
Even in exile Daniel and his companions gave wonderful examples of how to be faithful to God. (e.g. Daniel chapters 3 and 6)
After 70 years in Exile, in 539 BC God moved the Persian King Cyrus to allow 42,360 Israelites to return to Jerusalem. Ezra 1:1-4
In the first year of Cyrus king of Persia, in order to fulfil the word of the LORD spoken by Jeremiah, the LORD moved the heart of Cyrus king of Persia to make a proclamation throughout his realm and also to put it in writing. (Ezra 1:1)
The returning Exiles laid the foundations for a new Temple but opposition from the other local rulers meant work stalled for 15 years. Around 520 BC the prophets Haggai and Zechariah stirred up the people and the new Temple was completed and dedicated in 515 BC.
Then the word of the LORD came through the prophet Haggai: ‘Is it a time for you yourselves to be living in your panelled houses, while this house remains a ruin?’ (Haggai 1:3-4)
Around 458 BC Ezra went to Jerusalem to teach the people. He interceded with God (Ezra 9:1-15) and led the nation to repentance.
13 years later Nehemiah heard about delays in rebuilding the walls of Jerusalem. He prayed and then spoke boldly to the Persian King Artaxerxes. (Nehemiah 1:5-11; 2:1-5)
Lord, let your ear be attentive to the prayer of this your servant and to the prayer of your servants who delight in revering your name. Give your servant success today by granting him favour in the presence of this man.’ I was cupbearer to the king. …
The king said to me, ‘What is it you want?’ Then I prayed to the God of heaven, 5 and I answered the king. (Nehemiah 1:11, 2:4)
Despite local opposition the walls were completed. Ezra came back and read the Book of the Law to the people, who repented (Nehemiah 8:1-6, 18; 9:1-4). They dedicated the walls of Jerusalem and Nehemiah purified the people with further reforms.
So God brought his chosen people back to the Promised Land, the Holy City Jerusalem and to a new Temple, fulfilling all his promises to the remnant of Israel who had remained faithful (Isaiah 10:20-22; 11:11-12)