In this paper we give a necessary and sufficient condition for the controllability in arbitrarily small time of a finite-dimensional control-affine quantum system. The condition is expressed in terms of the Lie algebra generated by the controlled Hamiltonians of the system.