A scheme is proposed in which an internal degree of freedom, supplementing the space-time degrees of freedom, is introduced. It is assumed that a harmonic-oscillator potential acts on this degree of freedom. The dynamical U-italic(1) symmetry of the phase trajectory of the oscillator degree of freedom is identified with the gauge symmetry in electrodynamics. Localization of this symmetry ... [Show full abstract] introduces the electromagnetic field, which turns out to be a component of a connection on the space--time manifold extended by the phase space of the internal degree of freedom. The matrix of the tetrad of fields takes the characteristic triangular form, the electromagnetic-field tensor is found to be a component of the Riemann curvature tensor, and the scalar curvature coincides with the standard Lagrangian of the electromagnetic field.