How did Morocco get its name?

The Latinized name "Morocco" originates from medieval Latin "Morroch," which referred to the name of the former Almoravid and Almohad capital, Marrakech. The capital of morocco is now Rabat.