The main contribution of this paper is to explain where the imaginary structure comes from in quantum mechanics. It is shown how the demand of relativistic invariance is key and how the geometric structure of the spacetime together with the demand of linearity are fundamental in understanding the foundations of quantum mechanics. We derive the Stueckelberg covariant wave equation from first principles via a stochastic control scheme. From the Stueckelberg wave equation a Telegrapher’s equation is deduced, from which the classical relativistic and nonrelativistic equations of quantum mechanics can be derived in a straightforward manner. We therefore provide meaningful insight into quantum mechanics by deriving the concepts from a coordinate invariant stochastic optimization problem, instead of just stating postulates.