  We study the absorption and emission properties of the photoionised gas near
one of the brightest and most variable AGN, the Seyfert galaxy NGC 4051, in
order to constrain the geometry, dynamics and ionisation structure of the
outflow. We analyse two observations taken with the Low Energy Transmission
Grating Spectrometer (LETGS) of Chandra. We study the spectra of both
observations and investigate the spectral response to a sudden, long-lasting
flux decrease of a factor of 5 that occurred during the second observation. We
confirm the preliminary detection of a highly ionised component with an outflow
velocity of -4500 km/s, one of the highest velocity outflow components seen in
a Seyfert 1 galaxy. The sudden drop in intensity by a factor of five during the
second observation causes a drop in ionisation parameter of a similar magnitude
in the strongest and main ionisation component (v = -610 km/s), allowing us for
the first time to determine the recombination time of this component and
thereby its distance in a robust way. We find an upper limit to the distance of
10^15 m, ruling out an origin in the narrow emission line region. In addition,
an emission component producing strong radiative recombination continua of C VI
and C V appears during the low state. This can be explained by emission from an
ionised skin of the accretion disk at a distance of only ~4x10^12 m from the
black hole. Finally, the spectra contain a broad relativistic O VIII line with
properties similar to what was found before in this source with XMM-Newton;
this line has disappeared during the low flux state, consistent with the
disappearance of the inner part of the accretion disk during that low flux
state. (abridged)

Astrophysics