  The clustering of dark matter haloes with fixed mass depends on their
formation history, an effect known as assembly bias. We use zoom N -body
simulations to investigate the origin of this phenomenon. For each halo at
redshift z=0, we determine the time in which the physical volume containing its
final mass becomes stable. We consider five examples for which this happens at
z~1.5 and two that do not stabilize by z=0. The zoom simulations show that
early-collapsing haloes do not grow in mass at z=0 while late-forming ones show
a net inflow. The reason is that 'accreting' haloes are located at the nodes of
a network of thin filaments feeding them. Conversely, each 'stalled' halo lies
within a prominent filament that is thicker than the halo size. Infalling
material from the surroundings becomes part of the filament while matter within
it recedes from the halo. We conclude that assembly bias originates from
quenching halo growth due to tidal forces following the formation of non-linear
structures in the cosmic web, as previously conjectured in the literature. Also
the internal dynamics of the haloes change: the velocity anisotropy profile is
biased towards radial (tangential) orbits in accreting (stalled) haloes. Our
findings reveal the cause of the yet unexplained dependence of halo clustering
on the anisotropy. Finally, we extend the excursion-set theory to account for
these effects. A simple criterion based on the ellipticity of the linear tidal
field combined with the spherical collapse model provides excellent predictions
for both classes of haloes.
