  We show that a deformation of the Heisenberg algebra which depends on a
dimensionful parameter $\kappa$ is the algebraic structure which underlies the
generalized uncertainty principle in quantum gravity. The deformed algebra and
therefore the form of the generalized uncertainty principle are fixed uniquely
by rather simple assumptions. The string theory result is reproduced expanding
our result at first order in $\Delta p/M_{\rm PL}$. We also briefly comment on
possible implications for Lorentz invariance at the Planck scale.
