Since the beginning of femtomagnetism, it has been hotly debated how an ultrafast laser pulse can demagnetize a sample and switch its spins within a few hundred femtoseconds, but no consensus has been reached. In this paper, we propose that an ultrafast reduction in the exchange interaction by a femtosecond laser pulse is mainly responsible for demagnetization and spin switching. The key physics is that the dipole selection rule demands two distinctive electron configurations for the ground and excited states and consequently changes the exchange interaction. Although the exchange interaction change is almost instantaneous, its effect on the spin is delayed by the finite spin wave propagation. Consistent with the experimental observation, the delay becomes longer with a stronger exchange interaction pulse. In spin-frustrated systems, the effect of the exchange interaction change is even more dramatic, where the spin can be directly switched from one direction to the other. Therefore, our theory has the potential to explain the essence of major observations in rare-earth transition metal compounds for the last seven years. Our findings are likely to motivate further research in the quest of the origin of femtomagnetism.