Marrakesh is the fourth largest city in the Kingdom of Morocco. It is the capital of the mid-southwestern region of Marrakesh-Safi. It is west of the foothills of the Atlas Mountains. Marrakesh is 580 km southwest of Tangier, 327 km southwest of the Moroccan capital of Rabat, 239 km south of Casablanca, and 246 km northeast of Agadir.