Madrid barred the U.S. from using jointly operated military bases on Spanish soil to attack Iran, sparking fury from the U.S. president.