Carmelo Anthony of the New York Knicks reacts after missing...

Carmelo Anthony of the New York Knicks reacts after missing a potential game-winning shot at the buzzer against the Toronto Raptors at Madison Square Garden on Monday, Feb. 27, 2017. Credit: Jim McIsaac

Carmelo Anthony watched his shot bounce off the back of the rim, ripped off his headband and spiked it on the floor as he walked off the court.

The immediate cause of his frustration was that he had just missed being a hero and picking up a big win for the Knicks, missing a three-pointer at the buzzer as the Raptors held on for a 92-91 win Monday night at the Garden.

Yet that wasn’t the only legitimate reason for Anthony to be disgusted and annoyed by the loss. Perhaps the biggest reason was that when it came to crunch time, the Knicks had no answer for DeMar DeRozan.

The Toronto guard scored 37 points, including the Raptors’ last 12 points in the final three minutes. The most painful two points came with 1.9 seconds left. After DeRozan backed down Derrick Rose, he turned and made a fadeaway jumper over Rose’s outstretched arm.

The Knicks had a foul to give, which Jeff Hornacek had told the team before the winning basket.

“I think it was great ‘D’, better ‘O’,” Rose said. “I contested the shot. When I switched off on him other times, I contested the shot pretty well, too. I don’t know what to say after that.”

Said Hornacek: “DeRozan made a good shot. We had a look at the end.”

Anthony, who scored 37 points and hit the game-winning step-back jumper with three-tenths of a second left against the 76ers on Saturday night, led the Knicks with 24. He also came up with several big plays in the final quarter to keep the Knicks alive, assisting on a three-pointer by Courtney Lee that gave the Knicks a 91-90 lead with 10.6 seconds left. He shot only 9-for-26, however, including 2-for-9 on three-pointers.

Anthony said he was shocked that he was left wide-open for the final shot. After catching Lance Thomas’ inbounds pass about five feet beyond the arc, he saw no one near him, took a dribble forward and pulled up for a three.

“I wasn’t expecting to get a look like that,” he said. “It happened. I missed it. There’s not so much you can say about that. It was all about the shot. I had a wide-open shot. I made a tougher shot the other day. I should have made that shot.”

The Knicks opened a 17-point lead in the second quarter but scored only 14 points and shot 4-for-16 in the third quarter.

It was a frustrating day even before tipoff for the Knicks. Earlier, they announced that Joakim Noah had undergone knee surgery that likely will end his season. Then they signaled they were looking beyond this year by waiving backup point guard Brandon Jennings.

Hornacek bristled before the game at suggestions that the team, which has a first-round pick, was considering tanking the season. “As a team, we’re not thinking about losing,” he said. “If that’s what it comes down to and then we get a different draft pick, we’ll worry about it then. We’re still trying to win. Because Brandon was waived doesn’t mean that we’re not trying to win these games.”

Anthony certainly was trying to win down the stretch. “It was a tough one,” he said. “Especially like that. A couple of plays, a couple of rebounds and it could have gone our way.”

Notes & quotes: Hornacek said he hopes Kristaps Porzingis will be back for Wednesday night’s game at Orlando. Porzingis (sprained left ankle) missed his second straight game after being injured during Thursday’s loss to the Cavaliers. “K.P.’s better,” Hornacek said. “So I think he’s close enough that we can think next game he’s going to be there.”

Newsday LogoCovering LI news as it happensDigital AccessOnly 25¢for 5 months