NEW YORK — After a historic middleweight world title reign in which Gennadiy Golovkin made a division-record 20 consecutive title defenses before it came to an end by controversial decision at the hands of Canelo Alvarez some 13 months ago, GGG yearned for another title belt.

He got it on Saturday night at Madison Square Garden, but his brawl with Sergiy Derevyanchenko in a fight-of-the-year candidate might have been the hardest fight of his career and a result that will be debated for years to come.

Golovkin won a unanimous decision and a vacant middleweight world title before an announced crowd of 12,577, but he certainly did not look like the destroyer he has long been.

Judges Frank Lombardi and Eric Marlinski both scored the fight 115-112 and Kevin Morgan had it 114-113 for Golovkin, who dropped Derevyanchenko in the first round and cut him over the right eye in the second but seemed to struggle mightily with Derevyanchenko’s relentlessness for much of the fight. ESPN scored the fight 114-113 for Derevyanchenko, who failed in a second bid to win a 160-pound world title.

For much of the fight it appeared Madison Square Garden would be home to a second massive upset in four months, after Andy Ruiz Jr. took three heavyweight world title belts by seventh-round knockout from Anthony Joshua in the same ring on June 1.

But it was not to be, and the Derevyanchenko team fiercely argued that its man had won a fight so brutal that both men were taken to the hospital as a precaution afterward rather than appearing at a news conference.

“Sergiy proved he is one of the top middleweights in the world,” manager Keith Connolly said. “The crowd booed GGG and cheered Sergiy after the fight. There has to be a rematch if he doesn’t fight Canelo next. There is no other fight people will want to see. Even GGG’s own network, DAZN, which is paying him $100 million [under his three-year, six-fight deal], had Sergiy winning [114-113].”

Promoter Lou DiBella was emotional about his fighter, also believing he won.

“That was like [an Arturo] Gatti-[Micky] Ward fight at the highest level,” DiBella said. “That was a f—ing war. I thought we won. I honestly thought we did. I knew it would be close, but I thought we won. I am sure when I watch it again I will think that.

“Of course, a rematch. We want the rematch. What would you rather see? That again or another Canelo fight? Of course, that again. That was a great fight. That kid fought the fight of his life, and if he doesn’t get a rematch there is no f—ing justice.”

According to CompuBox, Derevyanchenko landed more punches on Golovkin than in any of the 25 fights of his it has tracked. He landed 230 of 738 blows (31%), while Golovkin connected with 243 of 720 blows (34%).

Even Golovkin, who wanted a third fight with Alvarez but was rebuffed and faced Derevyanchenko instead for the vacant title that had been stripped from Alvarez, did not sound as though he really believed he won the fight.

“I want to say thank you so much to my opponent. This was a great job. I respect his team. I told you, he’s a very tough guy,” Golovkin said. “This is huge experience for me. Right now, I understand I need more focus [on] boxing. This was a tough fight. I need a little bit more. I need to still get stronger in my camp. Just more serious. I need to work hard. I need a little bit more focus.

“Right now it’s bad day for me, it’s a huge day for Sergiy, his team. This is huge experience for me. Right now I know what I need exactly. I lost a little bit of focus. Sergiy was ready. I really respect him. He showed me such a big heart. I told him, ‘Sergiy, this is best fight for me.’ I just respect his team.”

Golovkin started fast, scoring a knockdown with 45 seconds left in the first round. He had hit Derevyanchenko with a combination before nailing him on top of the head for a knockdown, which Derevyanchenko seemed to shake off quickly. He had also been down in the opening round two fights ago in a split decision loss to Daniel Jacobs for the same vacant middleweight title.

“He hit me in the back of the head. He hit me behind the ear. I didn’t really see the punch, but it didn’t really affect me that much,” Derevyanchenko said. “I got up and I wasn’t really hurt so I continued to fight, so it was nothing, nothing too bad.”

Golovkin peppered Derevyanchenko with many shots in the second round, including a left hook that opened a bad cut over his right eye.

“I feel great. Thank you so much to all my fans, everybody who came to MSG. Thank you to my team. I want to thank everybody. It was a great night of boxing,” Derevyanchenko said. “The cut really changed the fight. I couldn’t see at times. And he was targeting the eye. But no excuses, it is what it is. I was trying my best.”

With the cut bleeding, a seemingly desperate Derevyanchenko went after Golovkin in the third round and landed a few shots to get the crowd excited, but Golovkin quickly got things under control, landing a hard right hand to the body and later a big left hook upstairs.

Derevyanchenko had an excellent fourth round in which he landed an assortment of combinations while GGG did not do all the much.

After the fifth round began, referee Harvey Dock called timeout for the ringside doctor to examine Derevyanchenko’s cut, but the fight quickly resumed. By the end of the fifth round, Golovkin had swelling under his left eye and he had been hurt by a late body shot.

They spent much of the sixth round trading punches back and forth as Golovkin’s white trunks began to turn pink from Derevyanchenko’s blood.

At the start of the eighth round, the ringside doctor again examined Derevyanchenko’s cut, but he was pronounced good to go and the combat continued at a spirited pace. Derevyanchenko put combinations together to drive GGG back. When he landed a stiff shot, Golovkin shook his head as if to say it did not hurt.

Golovkin (40-1-1, 35 KOs), 37, a Kazakhstan native fighting out of Santa Monica, California, landed a tremendous uppercut to open the ninth round that rocked Derevyanchenko, but he stayed on his feet and came back with a burst of punches a few seconds later in a fight that was tension-filled.

Derevyanchenko (13-2, 10 KOs), 33, a Ukraine native fighting out of Brooklyn, New York, opened the 10th round with a big onslaught of punches and briefly seemed to have Golovkin in trouble as the crowd stood and chanted “GGG! GGG!”

But the crowd could not lift Golovkin as Derevyanchenko continued to plow forward in an utter dogfight. Derevyanchenko landed two clean right hands later in the round that swiveled Golovkin’s head in an increasingly brutal fight.

“When I started moving, I felt like I was giving him room and I was getting hit with those shots that he threw — and that’s why I started taking the fight to him and getting closer and not giving him room to maneuver,” Derevyanchenko said.

Derevyanchenko kept the pressure on in the 11th round and Golovkin continued to have problems with him. This was not the dominating GGG who had ruled the middleweight division for so long.

Derevyanchenko was all over Golovkin in the 12th, looking to make it a definitive round, but Golovkin fought hard, too, and landed a left hook that knocked Derevyanchenko back with about a minute to go as the fight seemingly hung in the balance.

Golovkin said he would be pleased to give Derevyanchenko a rematch.

“Absolutely. Big fight for DAZN, for the people, of course I’m ready,” Golovkin said. “I’m a boxer. I’m ready for anything.”

Golovkin said he also would still like a third showdown with Alvarez, but that seems a long way off with a Derevyanchenko rematch an obvious fight and Alvarez disinterested in fighting Golovkin again, so much so that he declined to fight him this fall and instead is moving up two weight classes to challenge light heavyweight titlist Sergey Kovalev on Nov. 2.

“Absolutely, I’m just open to anybody,” Golovkin said of a third fight with Alvarez, whom he fought to a heavily disputed draw most thought GGG won in 2017, before a disputed majority decision loss in the 2018 rematch that ended his first 2010-18 title reign. “There are so many great champions here. Sergiy, a lot of guys. Everything is ready. Just call Canelo. If he says yes, let’s do it.”

Alvarez seemingly will say no if he maintains his current attitude. But Derevyanchenko? Count him in.

“I would like the rematch if it’s possible,” Derevyanchenko said. “I’m ready.”