After irradiating various medical linac parts with photon beams, underground gamma-ray spectroscopy (GRS) measurements of the samples were performed a few minutes after the irradiations, in order to observe short-lived radioisotopes. Three samples were used: an Elekta Synergy flattening filter never irradiated before, an old flattening filter, unmounted from a linac in 2012 and a tungsten leaf, unmounted from the multileaf collimator (MLC) of the same linac in 2012. All three samples were first measured in the underground laboratory of la Vue-des-Alpes. This underground location of the detector is providing a natural shielding against cosmic rays corresponding to 600 meters water-equivalent, reducing the cosmic muon flux by a factor 1000, and completely suppressing the neutrons. The laboratory is equipped with an ultralow noise germanium detector, protected against the rock radioactivity with an ultraclean lead and copper shielding. Moreover, the detector is enclosed in an airtight box, flushed out with nitrogen, in order to avoid radon to enter into the detector. A residual activity of 236.9 Bq was measured in the old filter with long-lived radioisotopes; with this work, it was possible to identify them: 57Co (T1/2 = 271.8 days), 54Mn (T1/2 = 312.3 days) and 60Co (T1/2 = 5.27 years). Prior to any irradiation, the tungsten leaf and the new filter were gamma counted, and showed only tiny amounts of trace impurities of 238U, 57Co, 54Mn and 60Co, with a total activity of 0.51 and 0.02 Bq, respectively. The new flattening filter and the leaf were then irradiated with ∼200 Gy, under 15 MV and 6 MV photon beams. The gamma counting began 20 min after the irradiations. A GEANT4 simulation was run for every sample, allowing quantitative results of the measured activities. Irradiations with 15 MV led to (n,γ) activation of short-lived isotopes: In the leaf, the measured activity was 1556 Bq just after the irradiation and we observed various gamma lines from 187 W, 57Ni and 56Mn. In the new filter, the activity was 1097 Bq and the gamma signature of 56Mn, 56Ni, 57Ni and 59Co was clearly present. The germanium detector allowed to measure gamma lines with relative intensities down to ∼0.1%, thanks to its very low background. Irradiation at 6 MV led to a small activation of 56Mn. Gammaspectroscopic data was taken several times after the irradiation to monitor the time evolution and the total activity. Treating patients with 15 MV photon beams activate long-lived radioisotopes in the linac head. With this work, it was possible to identify these isotopes, and highlight the created short-lived radioisotopes. In the literature, portable germanium detectors have been placed under the linac heads, but they were measuring the whole gamma spectra, and unable to decorrelate the activation of single linac components, or the activation of recent irradiations.