U.S. President Barack Obama has made a visit to Spain as he concludes a European tour shortened by a crisis over race-related shootings in the United States.
Obama met on July 10 with Spanish King Felipe VI and acting Prime Minister Mariano Rajoy in Madrid.
Obama said he and Rajoy had met at a challenging time for Europe and the world.
As the world integrates more rapidly, he said, it presents both "tremendous opportunities" and "grave dangers" if governments don't carefully coordinate their activities.
Obama said the United States and Spain are working together in some difficult places around the world and he's especially thankful for the work Spain is doing to train police officers in Iraq.
Obama met earlier at the Royal Palace in central Madrid for talks with King Felipe.
The U.S. leader also stopped at a naval base in Rota, near the southern Spanish city of Cadiz.
The base is home port for four U.S. Aegis destroyers, which form an integral part of the European missile-defense system.
The transfer of the system to NATO control was a key part of the alliance summit which ended July 9 in Warsaw.
Russia has called the missile-defense system a threat to the balance of power in Europe, but Western powers say it is for defense against rogue missile attacks from the Mideast region and beyond.
Obama, who arrived in Spain late July 9, has opted to shorten by one day his visit to Spain due to this week’s sniper attacks which killed five policemen in Dallas, Texas.
White House officials announced that Obama would be attending a memorial service in Dallas on July 12.
Authorities have named former U.S. Army Reserve soldier Micah Johnson, a 25-year-old African-American, as the lone gunman in the July 7 attacks.
The killed officers were monitoring a protest that had erupted in response to recent incidents where white police officers killed two black men in two U.S. cities in the states of Minnesota and Louisiana.
Speaking in a news conference in Madrid on July 10, Obama said that attacks on police out of a concern about the fairness of the criminal justice system hurt the Black Lives Matter movement.
Obama said although the "overwhelming" amount of activists in the Black Lives Matter movement wanted to see better relations between communities and police, there were always people that say "stupid" things.
He called on all sides to listen to each other.
"Maintaining a truthful and serious and respectful tone is going to help mobilize American society to bring about real change," Obama said.
Speaking at a news conference following the NATO summit in Warsaw on July 9, Obama called on Americans to unite against acts of violence and "not let the actions of a few define all of us."
He insisted the country's divisions were overplayed.
"First of all, as painful as this week has been, I firmly believe that America is not as divided as some have suggested," Obama said.
"When we start suggesting that somehow there's this enormous polarization, and we're back to the situation in the '60s, that's just not true," he added. "You're not seeing riots, and you're not seeing police going after people who are protesting peacefully."
Based on reporting by Reuters and AP