  We study energy functionals obtained by adding a possibly discontinuous
potential to an interaction term modeled upon a Gagliardo-type fractional
seminorm. We prove that minimizers of such non-differentiable functionals are
locally bounded, H\"older continuous, and that they satisfy a suitable Harnack
inequality. Hence, we provide an extension of celebrated results of M.
Giaquinta and E. Giusti to the nonlocal setting. To do this, we introduce a
particular class of fractional Sobolev functions, reminiscent of that
considered by E. De Giorgi in his seminal paper of 1957. The flexibility of
these classes allows us to also establish regularity of solutions to rather
general nonlinear integral equations.
