efe-epaKrasnodar (Russia)

The coach of Spain's national soccer team, Julen Lopetegui, has been fired two days before the squad's first match in the 2018 FIFA World Cup in Russia, after it was announced that he would be training European powerhouse Real Madrid next season, the president of the Spanish football association said Wednesday.

Spain's sporting director Fernando Hierro was named to replace Lopetegui - who had been at the helm of the Spanish squad since 2016 and remained unbeaten in 20 games - after his signing for Real Madrid was made public on the club's website Tuesday.

"We have been forced to act," Spanish Federation President Luis Rubiales said in a shock presser.

"We appreciate all that Julen has done because he is one of the main people responsible for us being here in Russia, but we are compelled to let him go," he added.

Rubiales said that he had lost confidence in Lopetegui after learning the news of his signing just five minutes before it was announced by Real Madrid.

"There has to be a clear message for all workers at the Spanish Federation that there are ways of acting that have to be followed," he said, adding "What we certainly cannot do at the federation is flout our own values."

"It is a hard situation, very painful, we would have liked to have Julen here for as long as possible, but it was not us who have decided to act this way," he concluded. "We couldn't just look the other way."

Hierro is set to lead his first training on Friday before making his debut as coach against Portugal, according to a statement published on the Spanish national team's official website.

The Spanish football federation (RFEF) had renewed Lopetegui's contract on May 21 for two more years, following Spain's qualification for the 2018 World Cup.

Lopetegui, who had been expected to appear in a press conference with Rubiales, instead decided to fly back to Spain and make his first comments there.