I have just found out that ancient Germanic people also had a term like "gaijin" (Japanese), "wairen" (Chinese, same kanji as in Japanese), "farani" (in Polynesia), farang (Thai), farangi (Persian), firang/farang/farangi (in India), goyim (Hebrew). It is Walha.

It seems that the "farang" and similar words that are used from Iran to Polynesia to refer to a Westerner or foreigner originally means "Frankish" (in the case of Persian) or "French". The Franks would have called them back "walha".

I think that because those terms of exclusion are so old in origin, it can reasonably be said that the original meaning was never to say that someone had a different nationality (very recent concept, less than 100 years old). It seems to mean that the different ethnicity and being an outsider to a society/group are the main meanings.