We prove the following theorem: axisymmetric, stationary solutions of the Einstein field equations formed from classical gravitational collapse of matter obeying the null energy condition, that are everywhere smooth and ultracompact (i.e., they have a light ring) must have at least two light rings, and one of them is stable. It has been argued that stable light rings generally lead to nonlinear spacetime instabilities. Our result implies that smooth, physically and dynamically reasonable ultracompact objects are not viable as observational alternatives to black holes whenever these instabilities occur on astrophysically short time scales. The proof of the theorem has two parts: (i) We show that light rings always come in pairs, one being a saddle point and the other a local extremum of an effective potential. This result follows from a topological argument based on the Brouwer degree of a continuous map, with no assumptions on the spacetime dynamics, and hence it is applicable to any metric gravity theory where photons follow null geodesics. (ii) Assuming Einstein's equations, we show that the extremum is a local minimum of the potential (i.e., a stable light ring) if the energy-momentum tensor satisfies the null energy condition.