We study how Abelian-gauge-field production during inflation affects scalar perturbations in the case when the gauge field interacts with the inflaton directly (by means of generic kinetic and axial couplings) and via gravity. The homogeneous background solution is defined by self-consistently taking into account the backreaction of the gauge field on the evolution of the inflaton and the scale factor. For the perturbations on top of this background, all possible scalar contributions coming from the inflaton, the metric, and the gauge field are considered. We derive a second-order differential equation for the curvature perturbation, ζ, capturing the impact of the gauge field, both on the background dynamics and on the evolution of scalar perturbations. The latter is described by a source term in the ζ equation, which is quadratic in the gauge-field operators and leads to non-Gaussianities in the curvature perturbations. We derive general expressions for the induced scalar power spectrum and bispectrum. Finally, we apply our formalism to the well-known case of axion inflation without backreaction. Numerical results show that, in this example, the effect of including metric perturbations is small for values of the gauge-field production parameter ξ>3. This is in agreement with the previous results in the literature. However, in the region of smaller values, ξ≲2, our new results exhibit order-of-unity deviations when compared to previous results. Published by the American Physical Society 2024