Japan’s men’s ice hockey team missed out on a place in the 2018 Winter Olympics in Pyeongchang, South Korea, on Friday after losing 3-1 to Latvia for its second straight defeat in the final qualifiers.

Japan, ranked 21st in the world, went 2-0 down early in the third period and although Shuhei Kuji scored two minutes before the end of the game, 12th-ranked Latvia scored in the dying minutes to seal the outcome. Japan had been looking for its first Olympic berth since it hosted the 1998 Nagano Olympics.

“We were able to attack, making most of the pace we have, but couldn’t take our chances. Scoring is the issue,” Kuji said. “The tide would have changed had we scored (the opener).”

Japan defended rigidly while looking to counter, but spurned three good chances midway through the second period before giving up the first goal.

“We had nothing to lose so we just focused on going all out,” captain Go Tanaka said. “We centered our play on defense as was our game plan, and were able to frustrate them. It wasn’t a bad performance, (but) not getting the result in these games is the issue with the team.”

Latvia will face 10th-ranked Germany, which beat Japan 5-0 a day earlier and also has two wins out of two, on Sunday in the last game of a four-team round robin with the winner booking its place in the Games in South Korea.

Japan will face 17th-ranked Austria.

Eight teams and Olympic host South Korea have already booked their berths in the 12-team competition. Three teams topping their respective final qualifying groups of four will complete the list.