We present a framework in which the projective symmetry of the Einstein-Hilbert action in metric-affine gravity is used to induce an effective coupling between the Dirac lagrangian and the Maxwell field. The effective $U(1)$ gauge potential arises as the trace of the non-metricity tensor $Q_{mu a}{}^a$ and couples in the appropriate way to the Dirac fields to in order to allow for local phase shifts. On shell, the obtained theory is equivalent to Einstein-Cartan-Maxwell theory in presence of Dirac spinors.