This paper considers a multistage serial inventory system with Markov-modulated demand. Random demand arises at Stage 1, Stage 1 orders from Stage 2, etc., and Stage N orders from an outside supplier with unlimited stock. The demand distribution in each period is determined by the current state of an exogenous Markov chain. Excess demand is backlogged. Linear holding costs are incurred at every stage, and linear backorder costs are incurred at Stage 1. The ordering costs are also linear. The objective is to minimize the long-run average costs in the system. The paper shows that the optimal policy is an echelon base-stock policy with state-dependent order-up-to levels. An efficient algorithm is also provided for determining the optimal base-stock levels. The results can be extended to serial systems in which there is a fixed ordering cost at stage N and to assembly systems with linear ordering costs.