An algebraic Riccati equation (ARE) is called a shifted M-matrix algebraic Riccati equation (MARE) if it can be turned into an MARE after its matrix variable is partially shifted by a diagonal matrix. Such an ARE can arise from computing the invariant density of a Markov modulated Brownian motion. Sufficient and necessary conditions for an ARE to be a shifted MARE are obtained. Based on the conditions, a highly accurate implementation of the alternating directional doubling algorithm (ADDA) is established to compute the extremal solution of a shifted MARE, as well as a quantity needed for computing the invariant density in the application, with high entrywise relative accuracy. Numerical examples are presented to demonstrate the theory and algorithms.