MADRID (AP) -- In just months, Julen Lopetegui has lost two of the most high-profile coaching jobs in the world.
Lopetegui was finally fired by Real Madrid on Monday, less than five months after he was sacked by Spain before the World Cup for not telling federation officials he accepted the Madrid job.
The latest firing followed a meeting by the club's board of directors on Monday, a day after the team was crushed by Barcelona 5-1 at Camp Nou Stadium.
Santiago Solari, coach of Real Madrid B, will take charge for the Copa del Rey match against third-division club Melilla on Wednesday.
Spanish media speculated Solari, a former Madrid player, was in the running for the permanent job along with former Chelsea manager Antonio Conte and Belgium manager Roberto Martinez.
The firing caps a horrible few months for Lopetegui and is likely to deal a significant setback to his career. After doing well with Spain's youth teams, he had a lackluster stint with Portuguese club Porto, but gained prominence after revamping Spain and turning it into a contender entering the World Cup.
"I want to thank the club for the opportunity it gave me and the players for their effort," Lopetegui told the local news agency EFE. "I wish the team the best for the rest of the season."
Madrid said in a statement it sacked 52-year-old Lopetegui to "change the team's dynamic while all of its objectives for the season were still reachable."
The board of directors believed there was a huge difference between the quality of the squad and the results it was achieving. The board noted the team has eight players nominated for the Ballon d'Or award, something unprecedented in the club's history. They have lost five of their last seven matches.
"We know that results are important for a coach," Madrid captain Sergio Ramos said after the Barcelona match.
Lopetegui, who led the team practice on Monday morning, was hired by Madrid to replace Zinedine Zidane, who quit after leading the club to the last three Champions League titles.
Losing the clasico left Madrid ninth in the Spanish league, seven points behind leader Barcelona after 10 rounds. It hasn't won in five straight league matches, with four losses, and recently reached its worst scoring drought ever.
The club had a decent start to the season but things went sour as the squad struggled to produce goals in its first season without Cristiano Ronaldo in nearly a decade. Madrid didn't replace the superstar; its only high-profile signing was goalkeeper Thibaut Courtois.
In 14 matches with Lopetegui, Madrid won six, lost six, and drew two.
After the Copa match on Wednesday, Madrid hosts Valladolid in the Spanish league, and visits Viktoria Plzen in the Champions League.
"We have to move on as soon as possible because there is a lot of season left," Ramos said.
To make things worse, veteran left back Marcelo is expected to be out for a few weeks because of a muscle injury. Forward Mariano Diaz is also injured and is likely to be out for at least a week.
Solari, aged 42, is a former Argentina midfielder who played for Real Madrid in the early 2000s and helped the team win the 2002 Champions League. He also played for Atletico Madrid and Inter Milan. He has been coaching Real Madrid B since 2016, taking over not long after Zidane left to coach the main squad.
Lopetegui is the second La Liga coach to be fired. The first was Leo Franco of promoted club Huesca, currently last in the 20-team standings.