This paper proposes a new stochastic model, based on a Vasicek non-homogeneous diffusion process, in which the non-linear trend coefficient (drift) depends on deterministic functions that describe the dynamic evolution of certain exogenous variables. After studying its probabilistic characteristics, and in particular the transition probability density and trend function, the associated stochastic inference based on discrete sampling in time is established using maximum likelihood methodology. This model is applied to detect, estimate and model the nonlinear trend present in data corresponding to CO 2 emissions in Morocco. Energy and financial variables that affect the behaviour of this trend are also detected, and substantial improvement provided by this non-homogeneous model with respect to its corresponding homogeneous version, is confirmed.