We propose a general strategy for determining the minimal finite amplitude disturbance that triggers transition to turbulence in shear flows. This involves constructing a variational problem that searches over all disturbances of fixed initial amplitude which respect the boundary conditions, incompressibility and the Navier–Stokes equations, to maximize a chosen functional over an asymptotically long time period. The functional must be selected such that it identifies turbulent velocity fields by taking significantly enhanced values compared to those for laminar fields. We illustrate this approach using the ratio of the final to initial perturbation kinetic energies (energy growth) as the functional and the energy norm to measure amplitudes in the context of pipe flow. Our results indicate that the variational problem yields a smooth converged solution provided that the initial amplitude is below the threshold for transition. This optimal is the nonlinear analogue of the well-studied (linear) transient growth optimal. At the critical threshold, the optimization seeks out a disturbance that is on the ‘edge’ of turbulence during the period. Above this threshold, when disturbances trigger turbulence by the end of the period, convergence is then practically impossible. The first disturbance found to trigger turbulence as the amplitude is increased identifies the ‘minimal seed’ for the given geometry and forcing (Reynolds number). We conjecture that it may be possible to select a functional such that the converged optimal below threshold smoothly converges to the minimal seed at threshold. Our choice of the energy growth functional is shown to come close to this for the pipe flow geometry investigated here.