The Toronto Raptors clinched the Atlantic Division title on Friday night.
But just not the way they wanted.
Carmelo Anthony scored 30 points, Amar'e Stoudemire had a season-high 24 points and 11 rebounds and the New York Knicks kept their slim playoff hopes alive by beating the Raptors 108-100.
Victory would have given Toronto its second Atlantic crown and first since 2006-07.
Instead, the Raptors got that a few minutes after walking off the court when Atlanta beat Brooklyn 93-88.
Red T-shirts reading 'Atlantic is ours' were draped across chairs inside a muted Toronto locker room, with the Raptors upset that they hadn't taken care of business themselves. Even so, they were happy.
"It's sweet and sour," Kyle Lowry said. "We'll take division champs any day."
Toronto's unexpected title guarantees them home court advantage in the first round of the playoffs but the loss dropped them a game behind Chicago, which rallied to beat Detroit Friday, in the race for the third seed in the East.
"It felt great to win the division," DeMar DeRozan said. "I don't think anybody would have picked us to win it, so that's definitely a great accomplishment. We're still anxious, we still want more"
J.R. Smith had 15 points, Raymond Felton 12 and Iman Shumpert scored eight of his 11 in the fourth quarter as the Knicks won for the first time in three games.
Had the Knicks lost, they would have been eliminated from playoff contention.
With three games remaining, the Knicks will need help to clinch a postseason berth.
"We dug such a hole early that it's been tough trying to dig out," Knicks coach Mike Woodson said. "We've got to hope that Atlanta loses the next three and we win three. That's the only way we have a shot."
New York hosts Chicago on Sunday, visits Brooklyn on Tuesday and finishes by hosting Toronto on Wednesday.
DeRozan scored 26 points and Lowry had 25 but the Raptors failed to match the franchise record for victories in a season (47) and disappointed a sellout crowd.
Jonas Valanciunas had 14 points and a career-high 21 rebounds, Terrence Ross scored 13 points and John Salmons had 10 for the Raptors, who had won four straight and seven of eight.
"I thought (the Knicks) played desperate and we failed to meet that," Toronto coach Dwane Casey said.
Toronto matched its season high with 15 3-pointers, but struggled with its shooting in a poor fourth quarter. The Raptors made five of 21 attempts in the fourth.
Hampered by a sore right shoulder, Anthony had struggled with his shooting in New York's past two games. He committed a season-high nine turnovers in last Friday's loss to Washington, and did not attempt a shot in the fourth quarter of Sunday's loss at Miami.
Rested and refreshed after a four-day break between games, Anthony looked better against Toronto. He made eight of 17 field goal attempts and went 13 for 14 at the free throw line.
"It helped, it helped a lot, just keeping it from getting hit and overusing it," Anthony said of the down time. "It helped big time."
Toronto had won its previous two meetings with New York this season, but Anthony sat out both those games with a sore right ankle.
Stoudemire played almost 40 minutes, the most this season, after telling Woodson he was ready to handle a bigger load.
"We're in a situation where it's a do-or-die moment and my body feels strong enough," Stoudemire said.
Woodson appreciated Stoudemire's effort.
"He came up big tonight with the big double double," Woodson said. "I just rode him. There were a few times I thought about pulling him, but I just stuck with him."
Ahead by one to start the fourth, New York outscored Toronto 11-5 over the first 4:12, getting six points from Shumpert in that span, to lead 89-82 with 7:48 left.
"When he's playing like that it adds energy to our team," Woodson said of Shumpert.
With Toronto's shooting in a funk, the Knicks pulled away, and back-to-back dunks by Stoudemire gave New York a 100-89 lead at 4:03, causing Toronto to call timeout.
The Raptors cut it to 102-98 on a three-point play by Lowry with 31 seconds left, but Smith answered with a pair of free throws. The Knicks were 32 for 36 at the line.
Smith, who took an NBA-record 22 3-point shots in Sunday's loss to Miami, didn't wait long to start firing again, missing from long range on the game's opening possession.
The outside shot was more of an option for the Raptors in the first quarter. Six of Toronto's eight made baskets came from beyond the arc, including three from Lowry, who scored 12 points as the Raptors took a 26-24 lead after one.
Toronto made just one 3 in the second but got six points each from DeRozan and Valanciunas, overcoming eight from Anthony, to lead 47-45 at halftime.
DeRozan scored 11 points in the third but Anthony had nine, including a jump shot with 17 seconds left, as the Knicks took a 78-77 lead into the fourth.
NOTES: Toronto's Amir Johnson returned after missing the three previous games with a sore right ankle. ... Lowry increased his career-high total of 3-pointers to 180, passing Morris Peterson's franchise record of 177, set in 2005-06. ... Canadian basketball player Andrew Wiggins attended the game.