In this work, we make use of the shifting-mean autoregressive model which is a flexible univariate nonstationary model. It is suitable for describing characteristic features in inflation series as well as for medium-term forecasting. With this model we decompose the inflation process into a slowly moving nonstationary component and dynamic short-run fluctuations around it. We fit the model to the monthly euro area, UK and US inflation series. An important feature of our model is that it provides a way of combining the information in the sample and the a priori information about the quantiTY to be forecast to form a single inflation forecast. We show, both theoretically and by simulations, how this is done by using the penalised likelihood in the estimation of model parameters. In forecasting inflation, the central bank inflation target, if it exists, is a natural example of such prior information. We further illustrate the application of our method by an ex post forecasting experiment for euro area and UK inflation. We find that that taking the exogenous information into account does improve the forecast accuracy compared to that of a linear autoregressive benchmark model.