In this paper we deal with a multi-period mean-variance portfolio selection problem with the market parameters subject to Markov random regime switching. We analytically derive an optimal control policy for this mean-variance formulation in a closed form. Such a policy is obtained from a set of interconnected Riccati difference equations. Additionally, an explicit expression for the efficient frontier corresponding to this control law is identified and numerical examples are presented.