Quasars, powered by gas accretion onto supermassive black holes1,2, rank among the most energetic objects in the Universe3,4. Although they are thought to be ignited by galaxy mergers5–11 and affect the surrounding gas12–15, observational constraints on both processes remain scarce16–18. Here we describe a major merging system at redshift z ≈ 2.7 and demonstrate that radiation from the quasar in one galaxy directly alters the gas properties in the other galaxy. Our findings reveal that the galaxies, with centroids separated by only a few kiloparsecs and approaching each other at a speed of approximately 550 km s−1, are massive, are forming stars and contain a substantial molecular mass. Yet, dusty molecular gas seen in absorption against the quasar nucleus is highly excited and confined within cloudlets with densities of approximately 105 to 106 cm−3 and sizes of less than 0.02 pc, several orders of magnitude more compact than those observed in intervening (non-quasar) environments. This is also approximately 105 times smaller than currently resolvable through molecular-line emission at high redshifts. We infer that, wherever it is exposed to the quasar radiation, the molecular gas is disrupted, leaving behind surviving dense clouds too small to give birth to new stars. Our results not only underscore the role of major galaxy mergers in triggering quasar activity but also reveal localized negative feedback as a profound alteration of the internal gas structure, which probably hampers star formation.