  We consider a discrete time hidden Markov model where the signal is a
stationary Markov chain. When conditioned on the observations, the signal is a
Markov chain in a random environment under the conditional measure. It is shown
that this conditional signal is weakly ergodic when the signal is ergodic and
the observations are nondegenerate. This permits a delicate exchange of the
intersection and supremum of $\sigma$-fields, which is key for the stability of
the nonlinear filter and partially resolves a long-standing gap in the proof of
a result of Kunita [J. Multivariate Anal. 1 (1971) 365--393]. A similar result
is obtained also in the continuous time setting. The proofs are based on an
ergodic theorem for Markov chains in random environments in a general state
space.
