Exclusive electroproduction of ω mesons on unpolarized hydrogen and deuterium targets is studied in the kinematic region of Q 2 > 1.0 GeV 2 , 3.0 GeV < W < 6.3 GeV, and −t < 0.2 GeV 2 . Results on the angular distribution of the ω meson, including its decay products, are presented. The data were accumulated with the HER-MES forward spectrometer during the 1996-2007 running period using the 27.6 GeV longitudinally polarized electron or positron beam of HERA. The determination of the virtual-photon longitudinal-to-transverse cross-section ratio reveals that a considerable part of the cross section arises from transversely polarized photons. Spin density matrix elements are presented in projections of Q 2 or −t . Violation of s-channel helicity conservation is observed for some of these elements. A sizable contribution from unnatural-parityexchange amplitudes is found and the phase shift between those amplitudes that describe transverse ω production by longitudinal and transverse virtual photons, γ * L → ω T and γ * T → ω T , is determined for the first time. A hierarchy of helicity amplitudes is established, which mainly means that the unnatural-parity-exchange amplitude describing the γ * T → ω T transition dominates over the two natural-parityexchange amplitudes describing the γ * L → ω L and γ * T → ω T transitions, with the latter two being of similar magnitude. Good agreement is found between the HERMES proton data and results of a pQCD-inspired phenomenological model that includes pion-pole contributions, which are of unnatural parity.