Answer
The primary reason for the founding of Samarra in 836 was to serve as a new administrative capital and military base for the Abbasid Caliphate. Caliph Al-Mu'tasim established the city to consolidate his power and control over the empire, as well as to house his growing army and bureaucracy.