He obtained a commission to Morocco. Spanish efforts to occupy their new African protectorate provoked the protracted Rif War (from 1909 to 1927) with native Moroccans.