Nehemiah 13:22

And I commanded the Levites that they should cleanse themselves, and that they should come and keep the gates, to sanctify the sabbath day. Remember me, O my God, concerning this also, and spare me according to the greatness of thy mercy.

This command belongs to Nehemiah's reformation after he returned from Persia to Jerusalem, when evils that had crept in during his absence threatened to pervert the nation and had contaminated even the precincts of the temple. The Sabbath reform was made necessary because heathen merchants and traders from the surrounding country and from Tyre had led Israelites to tread winepresses and to bring in sheaves and burdens, and to buy and sell fish and all kinds of goods in Jerusalem on the Sabbath. To keep Jerusalem closed to trade and so sanctify the Sabbath, he ordered the gates shut when it began to grow dark before the Sabbath and not opened until the Sabbath was past. He first stationed his own servants at the gates and warned away the merchants who lodged outside the wall.

He then commanded the Levites, after they cleansed themselves, to come and keep the gates to sanctify the Sabbath day. Their office would command greater respect than common people, and their close connection with the service of God would make them more zealous in enforcing obedience to His law. The scene is set in a stone-walled courtyard in Jerusalem, with bearded, turbaned Levites stationed together beneath a large arched gateway. Traders in long garments wait outside with a burdened donkey, containers, bundles, sacks, vessels and packs.