The reason for the Spanish restriction is that as an Airline Captain you have a level of authority (in law and obviously while in command of an aircraft) similar to a policeman. The state only granted such powers to Spanish nationals (I beleive that is still the case for the police in many contries). The law was changed under pressure from the EU.