We study a mean-variance portfolio selection problem under a hidden Markovian regime-switching Black–Scholes–Merton economy. Under this model, the appreciation rate of a risky share is modulated by a continuous-time, finite-state hidden Markov chain whose states represent different states of an economy. We consider the general situation where an economic agent cannot observe the “true” state of the underlying economy and wishes to minimize the variance of the terminal wealth for a fixed level of expected terminal wealth with access only to information about the price processes. By exploiting the separation principle, we discuss the mean-variance portfolio selection problem and the filtering-estimation problem separately. We determine an explicit solution to the mean-variance problem using the stochastic maximum principle so that we do not need the assumption of Markovian controls. We also provide robust estimates of the hidden state of the chain and develop a robust filter-based EM algorithm for online recursive estimates of the unknown parameters in the model. This simplifies the filtering-estimation problem.