||Early-type galaxies (ETGs) contain most of the stars present in the local Universe and, above a stellar mass content of similar to 5 x 10(10) solar masses, vastly outnumber spiral galaxies such as the Milky Way. These massive spheroidal galaxies have, in the present day, very little gas or dust in proportion to their mass(1), and their stellar populations have been evolving passively for over 10 billion years. The physical mechanisms that led to the termination of star formation in these galaxies and depletion of their interstellar medium remain largely conjectural. In particular, there are currently no direct measurements of the amount of residual gas that might still be present in newly quiescent spheroidals at high redshift(2). Here we show that quiescent ETGs at redshift z similar to 1.8, close to their epoch of quenching, contained at least two orders of magnitude more dust at a fixed stellar mass compared with local ETGs. This implies the presence of substantial amounts of gas (5-10%), which has been consumed less efficiently than in more active galaxies, probably due to their spheroidal morphology, consistent with our simulations. This lower star formation efficiency, combined with an extended hot gas halo possibly maintained by persistent feedback from an active galactic nucleus, keep ETGs mostly passive throughout cosmic time.