This paper describes a new procedure, based on string rewriting rules, for verifying that a finitely presented group G is nilpotent. If G is not nilpotent, the procedure may not terminate. A preliminary computer implementation of the procedure has been used to prove a theorem about minimal presentations of free nilpotent groups of class 3. Finally, it is shown that the ideas presented here may be combined with work of Baumslag et al. (1981) to prove that the polycyclicity of a finitely presented group can be verified.