Jalen Brunson of the Knicks reacts after a three-point basket in Game...

Jalen Brunson of the Knicks reacts after a three-point basket in Game 4 of the Eastern Conference first round against the Detroit Pistons at Little Caesars Arena on Sunday in Detroit. Credit: Getty Images/Gregory Shamus

DETROIT — As the clock wound down to the final few seconds, the ball rolled slowly along the baseline, with Mikal Bridges desperately trying to reach out his long arms as he crawled behind it. From flat on his stomach, he could see it reach Tim Hardaway Jr., alone in the corner and setting up to launch an uncontested three-point field-goal attempt.

Josh Hart came flying into the picture, leaping at Hardaway, contorting his body to try to contest the shot and making contact with him. And those final seconds seemed to take longer than the 47 minutes and 58 seconds that preceded it. The roll, the catch, the shot, the contact and finally, the ball falling short into the hands of Deuce McBride as time expired.

Pistons coach J.B. Bickerstaff and his players scrambled across the floor at Little Caesars Arena to argue and beg for one more chance. Meanwhile, the Knicks celebrated and danced their way to the exit, escaping with a 94-93 victory that could serve as a soul-crushing finish for the Pistons.

The Knicks battled back against the body blows delivered by the Pistons, bruised but now possessing a chance to close out the best-of-seven first-round series at Madison Square Garden on Tuesday night.

“I was sick,” Bridges said. “ ... I had it, then I lost it, then it just rolls. I’m like, I’m following the ball and it rolls right to Timmy. I’m like, ‘Oh my gosh.’ But thank God he missed it, and whatever else happened during that play.”

Even after it was over, there was more. A pool report from the officials said a foul should have been called on Hart on the final play.

The Knicks shook their heads and coyly avoided the topic. All except Hart, who admitted the contact but pointed out that in a game that felt like a brawl, things happen.

“During live play, it was judged that Josh Hart made a legal defensive play,” crew chief David Guthrie said in a pool report. “After postgame review, we observed that Hart makes body contact that is more than marginal to Hardaway Jr. and a foul should have been called.”

“Did I make contact with him?” Hart said. “Yeah. I made contact with him. Was it legal? I don’t know. We’ll let the two-minute report say that ... We go with whatever they call.”

“You go back and look at the film, the guy leaves his feet,” Bickerstaff said. “There’s contact on Tim Hardaway, his jump shot. I don’t know any other way around it. There’s contact on his jump shot. The guy leaves his feet. He’s at Timmy’s mercy, and I repeat, there’s contact on his jump shot.”

“You guys saw it,” Hardaway said. “Blatant. Thank you.”

But there was so much that came before that, too. Jalen Brunson limped to the locker room late in the third quarter, and after building a 48-32 lead, the Knicks found themselves down 79-68 when Malik Beasley hit a three-pointer with 8:35 remaining.

The Knicks were facing the prospect of heading back to New York with the series evened up. But this was a time for heroes, and they had them.

Brunson shrugged off his ankle injury to score 15 of his 32 points in the final 9:31, becoming the first player in NBA postseason history to record at least 30 points and at least seven assists in each of the first four games of a series.

Trailing 93-89, the Knicks cut the deficit to two on a tough baseline fadeaway by Karl-Anthony Towns with 1:29 left.

Cunningham missed a jumper with 1:07 remaining and Towns — who had been engaged in wrestling matches all day long but finished with 27 points and shot 5-for-7 from three-point range — delivered the go-ahead three with 47 seconds left.

Hart was able to strip the ball from Cunningham, who lost it out of bounds with 37.3 seconds left. After Brunson missed a jumper, Cunningham — who had 25 points, 10 rebounds and 10 assists — missed an open jumper with 7.4 seconds left, setting up the scramble for the loose ball that resulted in Hardaway’s last-second prayer.

“We were just connected in the last minute, able to get stops and a little bit of prayers here and there,” Brunson said.

Sitting next to him on the podium, Towns interjected, “It is Sunday.”

“It is Sunday,” Brunson repeated. Prayers answered.

The earlier prayers came late in the third quarter. Dennis Schroder hounded Brunson in the backcourt, Brunson lost the ball and went to the floor for it, and Schroder fell on Brunson’s right leg. Schroder came away with the ball and fed Cunningham for a fast-break dunk and a 65-61 Pistons lead.

Brunson dragged himself off the court and attempted to get to his feet but immediately buckled to the floor again. He finally was able to limp to the locker room with 2:52 remaining in the third quarter.

Brunson returned to the bench as the fourth quarter started, and with 10:14 left and the Knicks down 73-64, he checked back into the game.

“Moments like that, you’ve got to take a breath,” he said. “You’ve got to relax, you’ve got to think what’s going on. And I realized that I just needed to readjust and I made sure I was mentally ready to go back into the game, ’cause I was going back into the game. There really wasn’t a doubt, regardless of if I was stumbling or not.”

“If he’s got to go to the locker room,” Hart said. “Don’t let them see you down. But I know if he can walk, he’s going to play, he’s going to compete.”