Even with late-game heroics, the Nuggets could only tread water for so long.

They lost a 109-107 heartbreaker to Detroit on Tuesday night at Ball Arena when Jamal Murray made just three of six free throws — his final miss was intentional — in the final 3.5 seconds of the game. Twice, Murray put up a desperation 3-pointer in the closing seconds and twice drew fouls by Javonte Green, sending Murray to the line.

It was a crazy ending, but it was not to be for Denver.

“I’ve got to be better. I had a golden opportunity there — twice,” said Murray, who finished with a game-high 24 points and 10 assists on 7 of 18 shooting. But he was 0 for 6 from three-point range, and 10 of 15 from the free-throw line.

“We still had a chance,” coach David Adelman said, “with our best free-throw shooter, one of the best free-throw shooters I’ve ever seen, at the line. … He was great in the second half.”

Asked what he would say to Murray, Adelman replied: “I hope he shoots them again, because he’s a great free-throw shooter, and he’s made some of the biggest free throws in the history of this franchise.”

The Nuggets entered the game against the rugged, defensive-minded Pistons having gone 9-5 without three-time MVP Nikola Jokic. But, ultimately, the Nuggets couldn’t pull off a magic trick.

“We clawed and clawed but never got to the top of the mountain,” Adelman said. “A tremendous effort by the guys, but we just didn’t play well enough to win the game.”

Though the Pistons sputtered from behind the 3-point line — at one point, the Eastern Conference leaders were 1 for 21 — they had just enough to pull out the victory.

“They are a great defensive team, and they do this every night,” Adelman said.

Detroit entered the game having held opponents to 105 or fewer points in seven of its last nine games.

It was a gusty effort by the Nuggets, who trailed by 12 in the final quarter. And when Murray popped an 18-foot pull-up jumper — and did a little gig afterward — Detroit’s lead was down to 99-97 with 2 minutes, 27 seconds left. Murray led all scorers with 24 points.

With 56.4 seconds left, Tim Hardaway Jr. canned a 3-pointer from the top of the key, cutting the Pistons’ lead to 103-102.

Detroit won for the sixth time in its last seven games and improved to 34-11, by far the best record in the East.

The Nuggets played without starters Aaron Gordon (hamstring), Christian Braun (ankle), and, of course, Jokic. The center, out for a month with a knee injury, is making steady progress toward returning, but the Nuggets won’t rush him back.

However, Denver continues to face a major challenge without Jokic. They entered Tuesday’s game ranked 21st in the NBA in field goal percentage since Jokic’s injury (45.7%).

Denver trailed by as many as 18 points, but Adleman said, “We played our (butts) off” to get back into the game.”

Detroit’s star guard Cade Cunningham, who’s been battling an injured wrist, led his team with 22 points.

The Nuggets found themselves in a 31-18 hole after a first quarter in which they shot 31.6% (6 for 19) and made just one 3-pointer on eight attempts. The Pistons were also stone cold from behind the arc (1 for 9), but they dominated the glass and in the paint, outscoring Denver 24-6.

Want more Nuggets news? Sign up for the Nuggets Insider to get all our NBA analysis.