Spain remained neutral in World Wars I and II but suffered through a devastating civil war ( 1936 - 39 ) .