What determines whether an element is stable or unstable?

"The most stable electron configuration is the one in which the electrons are in orbitals with the lowest possible energies." - High School Science Florida by Prentice Hall p.32