Nehemiah 13:20

So the merchants and sellers of all kind of ware lodged without Jerusalem once or twice.

The lodging without Jerusalem took place in the reform carried out after the return from Persia, when evils threatening to pervert the nation had crept in during the absence from Jerusalem. Those who lodged were heathen merchants and sellers of goods of every kind from the surrounding country, who led Israelites to engage in traffic on the Sabbath, the sign distinguishing Israel as worshipers of the true God from all other nations. At first the traders were not kept out of the city; instead the people had pledged not to buy from them on the Sabbath, hoping this would discourage them and end the Sabbath traffic.

Then the gates of Jerusalem were ordered shut when darkness began before the Sabbath and kept closed until the Sabbath was past, with servants stationed at the gates to enforce the order. Shut out in this way, the traders and vendors with their laden donkeys, sacks, vessels and packs spent the night outside Jerusalem around the wall once or twice, unwilling to abandon their purpose and hoping to find opportunity for trade with the citizens or the country people. They were confronted for lodging by the wall and warned they would be punished, with the threat that hands would be laid on them if they did so again.

From that time they came no more on the Sabbath, and the Levites, as more respected and zealous enforcers of the law, were directed to guard the gates and entrances to keep those bringing wares from coming in.