Invariance theory for nonlocal variational principles—IV. Lagrangian classes