c. 1400, from Old French loialte, leaute "loyalty, fidelity; legitimacy; honesty; good quality" (Modern French loyauté), from loial (see loyal). The Medieval Latin word was legalitas. The earlier Middle English form was leaute (mid-13c.), from the older French form. Loyalty oath first attested 1852.
Allegiance ... is a matter of principle, and applies especially to conduct; the oath of allegiance covers conduct only. Loyalty is a matter of both principle and sentiment, conduct and feeling; it implies enthusiasm and devotion .... [Century Dictionary, 1897]