King Felipe opened the 18th Mediterranean Games in Tarragona's Estadi Gimnastic amid jeers and cheers.
It was the only sour note in an Opening Ceremony here that had simplicity, originality and style.
Catalan activists had invited people to greet the Spanish Royal party by banging saucepans.
A group of around 300 gathered on the approaches to the stadium.
A smaller gathering of Royal supporters waved the Spanish national flag and sang "Y Viva Espana" for the television cameras.
Inside, as the King took his seat, the strains of the "Marcha Real", Spain's national anthem, were heard and around the stadium hundreds of Spanish flags were waved.
Catalan President Qim Torra had taken his place alongside the King in the Royal Box but there were jeers from some of the crowd when his name was mentioned in the speeches of welcome by Organising Committee President Jose Felix Ballesteros and Mediterranean Games President Amar Addadi.
Torra handed the King a dossier on the events around the Catalan independence referendum when the pair met before the Ceremony.
As the King rose to make the short declaration of opening, there were some catcalls and for a moment he struggled to make himself heard but many throughout the crowd shouted "Viva el Rey".
It was an indication of the strength of feeling on both sides but it could not overshadow a magical Ceremony entitled "dreams of stone and water" which took its inspiration from the ancient world.
The show was directed by Hansel Serna who had worked with the renowned "Cirque de Soleil".
It began with the entry of nine lifesize representations of Tarracus, the mascot of these Games.
Each was decorated with distinctive colours to represent the spirit of the Mediterranean.
The mascot even had its own song, sung by Cuban born singer Lucrecia.
Then came a song specially composed for the Games, "Juguem per Viure", performed by a group of singers called Petacar and accompanied by a choir of schoolchildren.
Greece led the parade of nations, a tradition begun 90 years ago at the 1928 Amsterdam Olympic Games.
Their flag was carried by archer Evangelia Psarra.
They were followed by Albania, in national colours of red and black.
Some of the team chose to display a giant Albanian flag.
After Andorra came Algeria, ''Argelia'' in Spanish.
Their flag was carried by boxer Reda Benabaziz.
In 2021, the Algerian city of Oran will be the next host.
The march included some poignant moments.
Many of the team from Bosnia and Herzegovina wore their national flag around their uniforms as an improvised cape.
Their presence was a reminder of the 1992 Olympics held in Barcelona at a time when Bosnia was embroiled in a bitter war in the Balkans.
They were allowed to compete under their own flag.
The entry of Kosovo was another reminder of that conflict.
The announcer introduced them as "Olympic Committee of Kosovo" - a special form of words which seemed to be deliberate.
The Spanish Government does not yet have diplomatic relations and it had taken fierce lobbying by Tarragona officials to make sure that the necessary visas were granted for their team of 40.
Many of the team waved their national flag as they entered behind flagbearer Herolind Nishevci from karate.
On what was still a very warm evening, most teams had opted for shorts and sports uniforms but some of the French wore red, white and blue to construct a giant human tricolour.
The Montenegrans chose to hold red and yellow scarves, which seemed to start a trend when followed by Portugal, parading in the Games for the first time.
They are not strictly a Mediterranean country but they will provide some great Iberian rivalry to their neighbours.
The arrival of the Spanish team produced the biggest roar of the night.
Their flagbearer was swimmer Mireia Belmonte, the Olympic 200 metres butterfly champion at Rio 2016 two years ago who is expected to add some stardust to these Games.
For King Felipe, it must have brought back memories of the 1992 Olympics when he carried the Spanish flag as they entered the Montjuich Stadium.
The ceremonial Mediterranean Games flag, three rings on white on a blue background, had arrived from the sky in spectacular fashion, brought in by parachutists of the "Patrulla Acrobatica".
The colour party included the Mayor of the Athletes' Village Jesus Angel Garcia Bragado, gymnast Bito Fuster, swimmers Santiago Esteva Alberto Duch and Silvia Fontana and handballer Carme Rams, a competitor at the 1979 Games in Split.
Before it was raised, the flag was passed over the heads of the athletes, which recalled the wonderful moment at the 1992 Games when a giant Olympic flag was lowered over the field where the competitors had drawn up.
The oath was taken by weightlifter Lidia Valentin, upgraded to Olympic champion for 2012 after doping violations, and official Jordi Ribeira.
A ceremony of water was an inspired moment which was a reminder of the 1955 Mediterranean Games.
Here, maidens poured water into the fountains around the centre stage as seven gymnasts formed the shape of a coral.
The stage was constructed around four columns.
These appeared to be in ruins but as the finale unfolded, the columns rose as the dancers returned in sequences which represented ''humanity'' and ''the natural world".
The performers returned to perform one last number and were joined by Tarracus as fireworks crackled overhead.
It was little wonder that Organising Committee boss Ballesteros, who also happens to be the mayor of Tarragona, seemed delighted as he left the stadium.
Yet the local paper Diari de Tarragona devoted no fewer than four pages to the political stand-off with the verdict "brilliant sports Opening Ceremony but politically tense''.
The big sporting paper Marca likened it to a bullfight and spoke of "whistles and applause for the King in a politicised ceremony''.