God's special people, the Jews, did not obey God. So he punished them. He allowed the king of Babylon and his army to defeat them. The king of Babylon ordered most Jews to live in Babylon. Babylon was a long way from their country, called Judah.
Many years later, the army from Persia defeated the army from Babylon. The king of Persia allowed the Jews to return to their own land. Only some of the Jews returned to Judah.
Many years later a man called Hanani left Judah to visited his brother, Nehemiah. Nehemiah was an important servant of the king of Persia. Nehemiah asked Hanani for news about Jerusalem, which was the chief city in Judah. Hanani told Nehemiah that the walls of Jerusalem were only heaps of stones. Fire had burned the gates of the city.
This news made Nehemiah very sad. So Nehemiah asked the king to send him to Jerusalem to build the walls of the city again.
The book of Nehemiah in the Bible tells the story of how Nehemiah and the people built the walls of Jerusalem again. The people who lived near Jerusalem did not want the Jews to build the city again. They opposed the Jews and tried to stop the work. But God helped them and they finished the work in 52 days.
God wanted the Jews to become his special people again. So Nehemiah, with the help of Ezra, helped the people to obey God. But often the people did not obey God's word. They had forgotten that God had punished the people many years earlier. He did that because they did not obey him. God had allowed a foreign king to defeat the Jews. That was why the city of Jerusalem needed these repairs.