The Toronto Raptors looked to be on their way to perhaps their most impressive win of the season, but in the final seconds, a controversial referee made a controversial call, setting off Raptors fans on social media.

The Raptors trailed by one point with just under 30 seconds remaining in Monday night’s game on the road against the Denver Nuggets when their star sophomore Scottie Barnes was abruptly thrown out of the game by veteran official Scott Foster.

Toronto didn’t score again after that, and the Nuggets came away with a 118-113 win in a game many Raptors fans believe was stolen in the final minute.

The technical foul and ejection was assessed to Barnes as he held his hands up in disbelief after a foul was called against center Jakob Poeltl under the Raptors basket.

“I was just saying something to myself, and I guess he took offense to it,” said Barnes postgame.

“So, he jus threw me out of the game. I was just talking to my self.”

Barnes was visibly confused on the court after Foster signalled that he’d been thrown out, as were other Raptors players, and seemingly, one of the other officials.

Raptors coach Nick Nurse was also upset about the call, which ultimately led to a three-point possession by the Nuggets, putting the game out of reach for Toronto.

“I think it was a great game that looked like it was coming down to a great ending and it was a little bit unfortunate that we didn’t get to see a good ending,” Nurse said.

“Especially on the one Scottie got ejected on, I mean, there was absolutely nothing there. Nothing.”

Following the game, Foster told a local reporter that “[Barnes] was ejected on one technical foul because he used verbiage which directly questioned the integrity of the crew.”

This isn’t the first time Foster has drawn the ire of basketball fans.

The veteran referee has been accused of having a short fuse in the past. Some players have also taken issue with how he has officiated certain players or teams, most notably Phoenix Suns point guard Chris Paul.

Had the Raptors hung on to win the game, it would have been one of their best performances of the season.

Denver’s 46-19 record is second-best in the NBA, and they’re a league-leading 30-4 at home.

Toronto will now travel to Los Angeles to play former Raptor Kawhi Leonard and the Clippers tomorrow, followed by the Lakers on Friday, before returning home to face the Nuggets once again next Tuesday.