Ezra and Nehemiah were the leaders of a second wave of returnees to Zion; the governor Nehemiah arrived in 445 BC and the priest Ezra arrived in 398 BC.
Ezra and Nehemiah represented a group of returnees who claimed that they had a pure lineage traceable all the way back to before the exile, and were thus the real Judeans with a claim to Jerusalem. Ezra and Nehemiah protested that the mixed locals were pseudo-Jews and were not a pure Jewish line like the Second Return allegedly represented; they thus initiated ethnic separatist reforms.
נְחֶמְיָה Nehemiah's reforms
Nehemiah saw Jerusalem in a very grim, ruined state. Nehemiah pushed to rebuild the walls of Jerusalem (Nehemiah 2-3, 4:15-17) and replant crops to increase the population of the city.
The Jewish identity tensions that arose in the First Return did not go away (Ezra 4-5). The Am Ha-Aretz were ready to attack at any moment and workers rebuilding the walls clutched their weapons with one hand and tools with the other. Nehemiah shamed the Jerusalem elders with his picture of the city, and the whole city united, priests and laity alike, to erect new walls in a stunning mere 52 days.
Nehemiah instituted reforms: he created a lottery to forcibly relocate people to Jerusalem; he banned charging interest, creating tension with the wealthy but relieving the poor; and in his second term, he outlawed marriage between the Golah and the Am Ha-Aretz.
He believed that the exiles were under divine grace, and that Israelites were a holy, separate people. Their identity excluded those outside the Golah unit, and marrying these outsiders was equivalent to exiting the sacred enclave to immerse oneself in the non-sacred, the profane.
These excluded Jews would form their own identity, still extant today as Samaritans.
עזרא Ezra's reforms
The biblical author portrays Ezra's mission as pivotal -- it was he who took Nehemiah's reforms even further.
He saw priestly and marital collusion between the Golah and the Am Ha-Aretz. Nehemiah summoned all the Golah to a meeting in Jerusalem, and any who failed to attend would be excommunicated and his property seized. Ezra read to the citizens the Law, explaining as he went along. It is unclear whether this was the Deuteronomy, the Holiness Code or the entire Pentateuch. The people were stunned, having never heard it before.
Ezra commanded them to take literally a passage from the Torah that they live during the month of Sukkoth like their ancestors' forty years of wilderness. The Golah set up booths throughout Jerusalem with branches taken from the hills. For seven days they lived in these booths, a carnival atmosphere presiding, and each night listened to Ezra exposit the Law.
The next assembly was not so cheerful: amid torrential rain, Ezra limited Jerusalem only to those descended from the exiles, and all foreigners, including wives, had to be sent away.
A ruthless exclusivity henceforth characterized Jerusalem. Ezra 9-10 presents a radical ethnic separatist on Jewish identity, though the vehemence of Ezra underlies the overall nonchalance of the population. The Book of Ruth presents a moderate, accepting story of intermarriage.