This article investigates the dynamic mean-variance hedging problem of an insurer using longevity bonds (or longevity swaps). Insurance liabilities are modeled using a doubly stochastic compound Poisson process in which the mortality rate is correlated and cointegrated with the index mortality rate. We solve this dynamic hedging problem using a theory of forward–backward stochastic differential equations. Our theory shows that cointegration materially affects the optimal hedging strategy beyond correlation. The cointegration effect is independent of the risk preference of the insurer. Explicit solutions for the optimal hedging strategy are derived for cointegrated stochastic mortality models with both constant and state-dependent volatilities. Copyright © 2015 The Journal of Risk and Insurance.