Injection, trapping, and acceleration of electrons in a three-dimensional nonlinear laser wakefield