Answer
Samarra, located north of Baghdad, was established as the new capital by Caliph al-Mu'tasim in 836 CE. This move was motivated by the need for a more secure and defensible location, as well as the desire to distance the caliphate from the influence of the powerful Abbasid family in Baghdad.