Even though God had made it possible for all of the exiles to go back to Jerusalem, only some of them were willing. Those who were willing to go did so not because they were godlier and wiser than the other Jews, but because God worked in their hearts to act. The need for God to intervene not only in creating the right circumstances but also empowering his people to action is thus seen in this verse. People had to decide to go (human responsibility) but this was only in response to people being stirred up by God to go (divine sovereignty).1
5 Then rose up the heads of the fathers’ houses of Judah and Benjamin, and the priests and the Levites, everyone whose spirit God had stirred to go up to rebuild the house of the LORD that is in Jerusalem.