[But] a stranger that dwelleth with you shall be unto you as one born among you,.... Especially if a proselyte of righteousness; for then he enjoyed the same privileges, civil and religious, the Israelites did, for there was one law for them both, Exodus 12:49:
and thou shalt love him as thyself; and show it by doing all the good things for him they would have done for themselves in like circumstances:
for ye were strangers in the land of Egypt: and therefore knew what hardships such were exposed unto; and it became them to put on bowels of compassion, and show pity to those in a like condition, and particularly consider, as Jarchi suggests, that they were idolaters there also, and therefore ought not to upbraid strangers with their former idolatry:
I [am] the Lord your God; who showed kindness to them when strangers in Egypt, and had brought them out of that land, and therefore ought to obey his commands, and particularly in this instance.