  We prove that the word problem of a finitely generated group $G$ is in NP
(solvable in polynomial time by a non-deterministic Turing machine) if and only
if this group is a subgroup of a finitely presented group $H$ with polynomial
isoperimetric function. The embedding can be chosen in such a way that $G$ has
bounded distortion in $H$.
