NEW YORK — Over the past decade, Novak Djokovic has set about transforming himself into an athlete with virtually no tactical, physical or psychological weakness.

His endgame was audacious: to not only insert himself into the two-way conversation of tennis greatness being waged by Roger Federer and Rafael Nadal but to stake his claim as the greatest man ever to play the game.

Sunday’s U.S. Open final represented the last step, but it was derailed by Daniil Medvedev, who staged a 6-4, 6-4, 6-4 upset that halted Djokovic’s bid for the Grand Slam, which hasn’t been achieved by a man since Rod Laver in 1969, and denied the men’s record 21st major that would have broken Djokovic’s three-way tie with Federer and Nadal.

With Medvedev’s victory, achieved in a ruthlessly efficient 2 hours 15 minutes before a capacity crowd at Arthur Ashe Stadium that had come to witness history, the debate over the greatest man to play the game will no doubt continue.

Gracious in victory, Medvedev offered his opinion during his post-match remarks. Speaking directly to Djokovic, he said, “To me, you are the greatest tennis player in history.”

At 34, Djokovic is not finished with his career and is likely to have multiple opportunities to win a 21st major, or more. But the chance at a Grand Slam — winning all four majors in a single year — may not come again. It requires 28 consecutive Grand Slam victories to claim the Australian Open, the French Open, Wimbledon and the U.S. Open. Djokovic managed 27.

With neither Federer, 40, nor Nadal, 35, competing at the U.S. Open, Djokovic’s final hurdle was second-ranked Medvedev — a 25-year-old, lean, lanky 6-foot-6 Russian with a massive serve and forehand.

Medvedev came out blazing, strafing the court with forehand blasts and a barrage of aces. He broke Djokovic’s serve in the opening game and never eased off.

The Russian waged an all-out attack at lightning tempo, pummeling the top-ranked Djokovic, who seemed uncharacteristically tentative and a step slow at the outset, as if he were a dazed prizefighter on the ropes.

Less than seven months earlier, Djokovic had routed Medvedev in straight sets to claim the Australian Open title and his 18th major, setting in motion this quest for the Grand Slam. That victory in Melbourne took less than two hours.

But Medvedev did some mental and physical work on himself, too, after that undressing, conceding this past week that he had failed to “leave my heart on the court” during the match. Having secured his third opportunity to win a first Grand Slam title in Sunday’s final, Medvedev vowed to spill all he had on court against Djokovic.

The 25,703 fans at Arthur Ashe Stadium, which included Laver and a slew of luminaries from the sports and entertainment worlds, spilled their lungs on Djokovic’s behalf. Like the Serbian, they had no interest in going down without a fight. But against Medvedev’s unrelenting assault, there was only so much that the crowd — and Djokovic — could do.

Medvedev blasted 16 aces and fended off five of six break points against the game’s best returner.

He set the no-mercy tone at the outset, closing the first set in 36 minutes. The second set flew by much the same, with Djokovic’s frustration mounting.

After plowing a volley into the net on a hard-earned break point, Djokovic cocked his arm as if to smash the ball in anger, conjuring memories of the outburst that had gotten him disqualified at the 2020 U.S. Open for inadvertently hitting a lineswoman with a ball struck in frustration. This time, he caught himself, only to smash his racket moments later after failing to convert a clutch of break points. It drew an official warning from the chair umpire.

In short order, Djokovic was two sets in arrears.

He had trailed in earlier matches with the Grand Slam bid at stake. In June, he clawed back from a two-sets-to-none deficit against Stefanos Tsitsipas in the French Open final. And in four consecutive matches leading up to Sunday’s final here, he ceded the opening set.

But his ability to fight back wasn’t there against Medvedev, who scarcely gave Djokovic a chance to breathe as he blasted ball after ball past him.

Medvedev’s only hiccup came when he twice served for the match and double-faulted both times. For Djokovic, the reprieve was brief. Upon clinching the victory, Medvedev fell on his side on the court.

After the two shared an embrace at the net, Djokovic retreated to his courtside chair, buried his head under a towel and wept.

“Tennis is such a brutal sport where there is no room for error when you’re playing top guys,” Medvedev said afterward. “I am a top guy; he is a top guy. ... It’s always about the small details. He definitely was not at his best; we saw him playing better. The question is, if he would be [at his best], would I be able to [keep] up with him? We can never know now.”

Djokovic had been vocal about his goal of winning the Grand Slam — a pronouncement some viewed as hubris. In an interview with the Associated Press, Laver, 83, questioned whether announcing his Grand Slam aspiration would cost Djokovic, adding needless pressure to an already herculean task.

In the end, it wasn’t hubris that felled Djokovic. Physical and mental fatigue did it — not to a debilitating extent but just enough to leave him a step slow, which represented chum in the water to the attack-minded Medvedev.

“I was just below par with my game,” Djokovic said. “My legs were not there.”

Djokovic’s eyes were red as he addressed the crowd during his on-court remarks. He began by congratulating Medvedev on an “amazing, amazing match” and tournament. “If there is anyone who deserves a Grand Slam title right now, it’s you,” Djokovic said.

Then he thanked the New York crowd, which has rooted against him often over the years.

“Even though I have not won the match, my heart is filled with joy,” he said. “I’m the happiest man alive because you guys made me feel very special on the court. You guys touched my soul. I’ve never felt like this in New York.”

— Liz Clarke

Find highlights from Sunday’s match, by Ava Wallace in Washington, below.