KAZAN, Russia (AP) — Changing coaches on the eve of the World Cup can be fraught with danger. Just look at Spain.

The Spaniards and last-minute replacement coach Fernando Hierro were surprisingly eliminated by Russia in a penalty shootout after a timid and uninspired performance.

For Japan, however, the decision to sack Vahid Halilhodzic just two months before the World Cup appears to have been justified despite the team's last-minute defeat to Belgium in the round of 16 on Monday night. Japan was leading 2-0 early in the second half in Rostov-On-Don before Belgium came back to win 3-2 with a scintillating counterattack in the last seconds of injury time.

It was a cruel blow for Japan, which appeared to have taken control of the match through goals from Genki Haraguchi and Takashi Inui.

"Devastating," was how coach Akira Nishino described the loss.

Japan had a memorable World Cup run under coach Akira Nishino.

The shock of the defeat — the first time a team has lost a World Cup knockout match outright after leading by two goals since West Germany defeated England 3-2 in a 1970 quarterfinal — will clearly take some time to come to terms with.

But Japan can take immense pride from its performance both in the Belgium match and in the tournament as a whole.

Four years after a hugely disappointing campaign in Brazil, Japan entered the World Cup as one of the lowest-ranked sides. Few expected the Blue Samurai to get out of their group, not least because of the change at the top.

But following victory over Colombia and a draw with Senegal, Japan advanced from its group despite a 1-0 defeat to Poland in its final group match. Admittedly, its progress was down to the fact that it received fewer yellow cards than Senegal after the teams could not be separated on points, goal difference or goals scored.

Still, it was a triumph of sorts for a team that had been fairly uninspiring during Asian qualifying. Fans across Japan had grown pessimistic about the team's prospects in the World Cup and bemoaned its habit of grinding out results.

Japanese soccer can be joyous and free-flowing, but the team's performances in the run-up to the World Cup were stilted and cause for concern. A 4-1 defeat to South Korea was followed by a 1-1 draw against Mali, and subsequently a 2-1 loss to Ukraine.

During that run, it was clear that relations between the Bosnian coach Halilhodzic and the players had deteriorated, and the Japanese Football Association made the decision to replace the coach in order to foster unity ahead of the World Cup. Halilhodzic had tried to turn a Japanese team with a fluid passing tradition into a counterattacking unit. He also, to the consternation of many in Japan, dropped three leading players at times: Keisuke Honda, Shinji Kagawa and Shinji Okazaki.

Nishino, who was the JFA's technical director, was given the task of rebuilding trust in the Japan camp, and the team's performances in Russia show that the players responded positively.

Nishino paid tribute to his predecessor, arguing that Halilhodzic had "nurtured this team." Though Nishino said he kept the core of Halilhodzic's tactics, he wanted to "add something."

That something was fairly clear in Russia. Japan played with a more attacking identity and a lot more freedom. Nishino encouraged his players to express themselves without fear of failure. Although he instructed his team to "stay put" and play passively in the closing minutes against Poland because a 1-0 loss would be good enough to advance, he said the strategy was "regrettable" and pledged to return to an aggressive style.

He kept his word against Belgium. Even after Belgium equalized, Japan kept trying to win instead of playing for extra time or a penalty shootout — the fallback tactic for World Cup underdogs that Russia executed successfully against Spain.

The risky approach may have ultimately cost Nishino's team in the final seconds. With the clock ticking toward extra time, Japan looked to score from a corner, but Belgium had other ideas, catching Japan off guard with a 10-second counterattack that culminated with Nacer Chadli's winner.

"I think it was me who might have lost control of the game," the 63-year-old Nishino said. "When the goal was conceded, I blamed myself, and I question my tactics."

Few in Japan are likely to blame Nishino for what was a thrilling, and wholly unexpected, World Cup ride.

___

More AP World Cup coverage: https://apnews.com/tag/WorldCup