Ezekiel 20:22

Nevertheless I withdrew mine hand, and wrought for my name’s sake, that it should not be polluted in the sight of the heathen, in whose sight I brought them forth.

The verse concerns the children of Israel during the forty years of wandering in the wilderness. That second generation greatly polluted God's Sabbaths by lax observance. Yet God withdrew His hand and restrained it from destroying them.

He acted and wrought for His name's sake, so that His name would not be polluted and dishonored in the sight of the heathen nations who had watched Him bring Israel forth out of Egypt. In mercy He did not prevent that second generation from entering Canaan, though He had excluded the first generation. At the same time He declared that because of their neglect of the Sabbath they would be scattered among the heathen after their settlement in the promised land.