The origin of “cagots” is not well defined: medical? In the Middle Ages, the lepers have been assimilated to “cagots”, afterwards the leper became an excuse. Ethnical? Meaning descendants of Visigoths. Religious? For example descendants of Moors?
Their existence is proven since the 12th century under the name of crestias and their segregation had lasted in the Pyrenees until the middle of the 20th century.