Abstract: Known results for the general linear mixed model and its special case, the variance components model, are applied to inference in state space models. New state and disturbance smoothing algorithms that accomodate fixed effects and diffuse initial conditions are developed. The algorithms are based on an augmented Kalman filter, and they avoid the backward recursions of standard smoothing algorithms. The disturbance smoother is used to develop an EM algorithm for REML estimation of variance components in state space models. The EM algorithm for the structural time series model with polynomial trend and additive seasonality is illustrated in detail