The energetic midfielder has become the latest big name to leave the Makhachkala outfit and will continue his career in the Russian capital
The Frenchman, 28, had moved to Dagestan from Real Madrid in the summer of 2012 and helped them to third spot in the table last term. However, the holding midfielder was deemed surplus to requirements following the Russian side's change of policy and will now continue this career with Lokomotiv.
Diarra has signed a three-year deal with the Moscow outfit.
Players such as Oleg Shatov (Zenit), Yuri Zhirkov, Igor Denisov, Aleksandr Kokorin (all Dinamo Moscow) and Mbark Boussoufa (Lokomotiv) previously left Anzhi following the club's changed policy.
Attacking midfielder Willian is widely expected to leave the club as well in the coming days after undergoing a medical with Tottenham this week, while Samuel Eto'o has been linked with clubs such as Roma, Chelsea and Inter.
Anzhi secured the services of a number of high-profile names in the past few years, but they now aim to build a new team consisting mainly of homegrown youngsters as they felt their big investments were not paying off.