After 12 rounds of their brutal battle at Madison Square Garden Saturday night, Gennady “GGG” Golovkin and Sergiy Derevyanchenko raised their hands and staggered to their corners exhausted and stained with blood.

It was up to the judges to decide who had won the IBF/IBO middleweight championship. Somebody wasn’t going to happy. Turns out a lot of people weren’t happy.

Golovkin came away with a unanimous decision to become a two-time middleweight champion. The scores 114-113, 115-112 and 115-112 drew plenty of boos for those who thought Derevyanchenko had done enough to win. The Post scored the bout 114-113 for Derevyanchenko, but the fight could have gone either way. All three judges gave Golovkin the final round.

Golovkin (40-1-1, 35 KOs) dropped Derevyanchenko (13-2, 10 KOs) in the first round, but went toe-to-toe with the Brooklyn-based Ukrainian for the rest of their fight. Derevyanchenko weathered a nasty cut over his right eye and took the fight to Golovkin using his faster hands and a relentless body attack to win rounds. Golovkin had to dig deep to keep Derevyanchenko from overpowering him.

It was brutal from the beginning. Derevyanchenko tried to establish his jab early in the first round. Golovkin stayed patient until midway through the round when a right to the top of Derevyanchenko’s head dropped him to the canvas. It was a flash knockdown as Derevyanchenko got up and finished the round without enduring further the damage.

Derevyanchenko was competitive in the second round, but suffered a cut over his right eye that looked like it could be problematic. The cut came from a clean left hook that snapped Derevyanchenko’s head back.

Seeing his own blood made Derevyanchenko aggressive in the third round. He began bouncing on his toes and trying to work Golovkin’s body, while landing quick combinations to his head that eventually caused a mouse under Golovkin’s left eye.

Derevyanchenko began to land the cleaner, faster punches in the fourth round as Golovkin seemed tire a bit. A theme entering the bout was whether Golovkin would start to show his age (37), and entering the fifth it looked like that might be happening.

Derevyanchenko appeared to hurt Golovkin late in the fifth as his speed and work-rate made Golovkin look slow and indecisive. By the sixth Derevyanchenko was starting to land at will with short uppercuts and quick combinations.

The cut over Derevyanchenko’s eye remained a concern and was looked at by doctors between just about every round. It added intensity to the fight as Derevyanchenko had to stay aggressive.

The 10th round proved to be special. The two gladiators traded punches until the final bell as the crowd roared with pleasure. It was anyone’s fight entering the 12th and the two waged war with heavy exchanges until the final bell.

Golovkin had hoped a win would set-up a third fight with Saul “Canelo” Alvarez, but a rematch with Derevyanchenko might be a more desirable option.