Courtney Lee and Carmelo Anthony of the New York Knicks...

Courtney Lee  and Carmelo Anthony of the New York Knicks look on late in a game against the Denver Nuggets at Madison Square Garden on Friday, Feb. 10, 2017. Credit: Jim McIsaac

The Knicks provided little resistance on the defensive end Friday night, allowing at least 30 points in every quarter of a 131-123 loss to Denver before a vocally unhappy sellout crowd of 19,812 at the Garden.

Jeff Hornacek was incensed at his starting five — Kristaps Porzingis, Carmelo Anthony, Courtney Lee, Derrick Rose and Brandon Jennings — for their defensive play and said “they should be embarrassed by the way they couldn’t guard anybody.”

The coach pointed out that with the second unit on the floor at the start of the second quarter, the Knicks played good defense and built a 12-point lead, but that when he went back to the starters for the last six minutes of the half, Denver shaved 10 points off that lead. “So those guys are happy scoring their points,” Hornacek said. “We’re going to lose every game.”

Hornacek said of the second unit, “They got after it defensively. They were helping each other out. They were trying, getting their hands on balls. They weren’t letting them run whatever they wanted. That’s my fault. I should have left those guys in.”

Carmelo Anthony, who scored 21 of his 33 points in the fourth quarter and helped the Knicks close the margin to six twice, said of Hornacek’s remarks, “If he’s saying it, that’s what he sees and that’s what it is. Some games we bring it, some games we don’t. Last game we brought it. Tonight we didn’t.”

It was the Knicks’ fourth straight loss — all at home — and their 20th in 26 games.

Nuggets center Nikola Jokic scored 40 points and shot 17-for-23 from the field. Denver, despite missing three key players, including leading scorer and former Knick Danilo Gallinari, shot 57 percent overall and 16-for-32 on three-pointers.

With Joakim Noah out with a hamstring injury, Porzingis started at center and was no match for Jokic, who had 18 points as Denver outscored the Knicks 36-22 in the third quarter.

“He has a soft touch around the rim and he’s quick,” said Porzingis, who had 17 points. “I was going for the block every time, and just a half a second too late to block his shot. And he was able to get those shots over me. But he had an unbelievable game. Unbelievable.”

The Nuggets took their biggest lead at 105-88 on Jamal Murray’s floater with 10:13 left in the game.

Hornacek said the Knicks’ analytics suggest that the team’s starting unit is “very good offensively and they’re terrible at defense” and that against the Nuggets, “they got zero stops. If you look at their starters down the line, they must have shot 75 percent against them.”

Brandon Jennings, who had 13 assists, said Hornacek “should be mad. We don’t play hard all the time. We play hard in stretches, and it’s tough. The fact that we go over things and teams are just scoring with ease on us? It’s definitely frustrating. It’s embarrassing to all of us. We’ve got to figure out a way or something, a solution to get this thing rolling.”