This study presents a Lagrangian analysis of upper-tropospheric anticyclones that are connected to surface heat waves in different European regions for the period 1979 to 2016. In order to elucidate the formation of these anticyclones and the role of diabatic processes, we trace air parcels backwards from the upper-tropospheric anticyclones and quantify the diabatic heating in these air parcels. Around 25 %–45 % of the air parcels are diabatically heated during the last 3 d prior to their arrival in the upper-tropospheric anticyclones, and this amount increases to 35 %–50 % for the last 7 d. The influence of diabatic heating is larger for heat-wave-related anticyclones in northern Europe and western Russia and smaller in southern Europe. Interestingly, the diabatic heating occurs in two geographically separated air streams; 3 d prior to arrival, one heating branch (remote branch) is located above the western North Atlantic, and the other heating branch (nearby branch) is located over northwestern Africa and Europe to the southwest of the target upper-tropospheric anticyclone. The diabatic heating in the remote branch is related to warm conveyor belts in North Atlantic cyclones upstream of the evolving upper-level ridge. ... mehrIn contrast, the nearby branch is diabatically heated by convection, as indicated by elevated mixed-layer convective available potential energy along the western side of the matured upper-level ridge. Most European regions are influenced by both branches, whereas western Russia is predominantly affected by the nearby branch. The remote branch predominantly affects the formation of the upper-tropospheric anticyclone, and therefore of the heat wave, whereas the nearby branch is more active during its maintenance. For long-lasting heat waves, the remote branch regenerates. The results from this study show that the dynamical processes leading to heat waves may be sensitive to small-scale microphysical and convective processes, whose accurate representation in models is thus supposed to be crucial for heat wave predictions on weather and climate timescales.