NBC and the NHL are the best of friends and the closest of allies.

Wait — maybe that should have been written in the past tense. The NHL has ticked off NBC, and NBC has turned around and very publicly thumbed its nose at the NHL by keeping it off national TV for the duration of the 2018 Winter Olympics.

Ouch.

The NBC broadcast network and cable’s NBC Sports Network have been the national TV home of the National Hockey League since 2006. The partnership has been good for the NHL, which didn’t get much attention from ESPN/ABC, and it helped establish NBCSN as a player in sports TV.

The NHL is, arguably, NBC’s second-biggest sports property. But it has messed with NBC’s biggest sports property — the Olympics.

NHL owners announced in April that they would not allow their players to participate in the 2018 Games in Pyeongchang, South Korea, ending a run of five consecutive Winter Olympics (including Salt Lake 2002) that saw arguably the best players in the world on the ice.

This did not please the folks at NBC, who paid almost $1 billion for the rights to the 2018 Games and will spend another couple hundred million bucks on production.

NHL owners made it clear they don’t want to take a two-and-a-half week break from their schedule in February — that they don’t want to “go dark” at a time when the NFL season is over and the baseball season has not begun.

Clearly, it does disrupt the NHL season,” said Jim Bell, NBC’s executive producer and president of Olympic programming and production. He was trying to be magnanimous a few weeks ago, even arguing that the lack of NHL players could be good for NBC because we “could very well see a good story line developing should some young Americans emerge as they did, most notably in that Cold War game a few years ago.”

Well, the Miracle on Ice — Team USA’s win over the USSR — was almost 38 years ago, before about half the Americans living today were born.

So much for the NHL’s plan. It will go dark on NBC and NBCSN from Feb. 7 to 26. The two outlets telecast 20 games during the corresponding days this past season.

When NBC announced its NHL schedule in July, those days were open. But the owners assumed they would be filled in later. They won’t.

Ouch.

This doesn’t mean that the NHL won’t be on TV at all. This doesn’t affect local and regional telecasts. As a matter of fact, local stations and regional cable outlets no doubt will air some of the games that would have ended up on NBC/NBCSN under other circumstances.

But national TV contracts are the most important to a league. And the National Hockey League essentially is losing its national TV contract for most of the month of February.

Here’s betting that NBC won’t spend a lot of time updating NHL scores during that time. And we already know ESPN barely pays any attention to hockey.

NBC’s Mike Tirico, who will host the prime-time telecasts, said he believes the absence of NHL players at the Olympics — and NHL telecasts on national TV — will “perhaps create some real estate for the U.S. women’s hockey team, which could become one of the great stories of the Games. It’s a terrific team.”

The American women are projected to be in the thick of the competition for the gold medal.

As we all experienced in Rio, so much of Team USA’s strength [comes from] the female athletes,” Tirico said. “So in hockey, for example, that might become one of the biggest stories.”