The advent of X-ray free-electron lasers has granted researchers an unprecedented access to the ultrafast dynamics of matter on the nanometre scale(1-3). Aside from being compact, seeded plasma-based soft X-ray lasers (SXRLs) turn out to be enticing as photon-rich(4) sources (up to 10(15) per pulse) that display high-quality optical properties(5,6). Hitherto, the duration of these sources was limited to the picosecond range(7), which consequently restricts the field of applications. This bottleneck was overcome by gating the gain through ultrafast collisional ionization in a high-density plasma generated by an ultraintense infrared pulse (a few 10(18) W cm(-2)) guided in an optically pre-formed plasma waveguide. For electron densities that ranged from 3 x 10(18) cm(-3) to 1.2 x 10(20) cm(-3), the gain duration was measured to drop from 7 ps to an unprecedented value of about 450 fs, which paves the way to compact and ultrafast SXRL beams with performances previously only accessible in large-scale facilities