Question: when did rabat become the capital of morocco
Answer: The French invaded Morocco in 1912 and established a protectorate .