The Wind and the Lion (1975)

spanishcastlemoviemagic.com

Although the action centres around the aggressive foreign policy of President Theodore Roosevelt, and even the sacred White House is none other than the elegant games room of the Hotel Palace in Madrid, built in 1912 by order of King Alfonso XIII and situated just across the road from the Spanish Parliament, for the rest of the film, the Moroccan parts were shot using scenery and cities from Andalusia. 

El Raisuli (Sean Connery) has his headquarters in the austere Moorish castle at La Calahorra, while his enemy the Sultan holes up in the Reales Alcazázares Palace in Sevilla amidst the splendour of an Arabic architecture that rivals the better known La Alhambra of Granada.