We introduce a nonlinear variant of the voter model, the q-voter model, in which q neighbors (with possible repetition) are consulted for a voter to change opinion. If the q neighbors agree, the voter takes their opinion; if they do not have a unanimous opinion, still a voter can flip its state with probability epsilon . We solve the model on a fully connected network (i.e., in mean field) and compute the exit probability as well as the average time to reach consensus by employing the backward Fokker-Planck formalism and scaling arguments. We analyze the results in the perspective of a recently proposed Langevin equation aimed at describing generic phase transitions in systems with two ( Z2-symmetric) absorbing states. In particular, by deriving explicitly the coefficients of such a Langevin equation as a function of the microscopic flipping probabilities, we find that in mean field the q-voter model exhibits a disordered phase for high epsilon and an ordered one for low epsilon with three possible ways to go from one to the other: (i) a unique (generalized-voter-like) transition, (ii) a series of two consecutive transitions, one (Ising-like) in which the Z2 symmetry is broken and a separate one (in the directed-percolation class) in which the system falls into an absorbing state, and (iii) a series of two transitions, including an intermediate regime in which the final state depends on initial conditions. This third (so far unexplored) scenario, in which a type of ordering dynamics emerges, is rationalized and found to be specific of mean field, i.e., fluctuations are explicitly shown to wash it out in spatially extended systems.