Conor McGregor stole the show during UFC 223 Saturday night at Barclays Center in Brooklyn and he wasn’t even fighting. At least not in the Octagon.

On Saturday, as UFC President Dana White had promised, McGregor’s reign as the sport’s lightweight king was over when Khabib Nurmagomedov beat Al Iaquinta. That left White making sense of a wild few days in UFC. “You can imagine he’s going to be sued beyond belief,” White said of McGregor’s rampage. “This was a real bad career move for him. Right now? No. I mean, do you want to be in business with Conor McGregor right now? Do you want to chase this guy around for interviews and buy his fights. Do you?”

Still, White planned to consider his options and, after Nurmagomedov’s win, his father, who is his coach, was game for a bout with McGregor. “He’s been stripped of the belt now, but if the UFC gives him the right to become a contender, why not?” Abdulmanap Nurmagomedov said. “It’s better if he fights Khabib than fights a bus.”

The Irishman turned himself in to police Thursday and was charged with three counts of assault and one count of criminal mischief after his role in a fracas that left UFC fighter Michael Chiesa in the hospital with a facial laceration he suffered when McGregor broke windows of a bus carrying fighters. The incident took place after a media event ahead of UFC 223.

McGregor appeared in handcuffs Friday afternoon in a packed Brooklyn courtroom, where a judge set bail at $50,000 and set a court date of June 14. The judge also said McGregor would be allowed to leave the country, according to reports. Per ESPN, he was released after a brief arraignment and ordered to stay away from fighters Michael Chiesa and Ray Borg, among others, including via social media.

The rampage apparently was directed at a rival fighter who was leaving Barclays Center. MMA Fighting reported that Cian Cowley, McGregor’s SBG teammate, also was charged with one count of assault and one count of criminal mischief over the incident; Cowley’s bail was set at $25,000, according to veteran MMA reporter Ariel Helwani, who called this week “without question the craziest five days in UFC history.”

McGregor, perhaps the most famous name in the sport, was led out of the 78th Precinct in Brooklyn and taken to a car Friday morning before the court appearance. He showed no emotion in the courtroom, according to ESPN’s Brett Okamoto, and left the courtroom through a back exit.

Three matches scheduled for Saturday’s UFC 223 card were scrapped because of the incident. Chiesa, who was to fight Anthony Pettis, was deemed unfit to fight by the New York State Athletic Commission and the UFC medical team. Ray Borg, a flyweight who was scheduled to battle Brandon Moreno, also was deemed unfit to fight after suffering corneal abrasions. Artem Lobov, a McGregor friend and ally who was part of the incident, also was pulled from the card.

Separately, Max Holloway, who was scheduled to fight Nurmagomedov for the UFC lightweight belt in the headline bout, was declared medically unfit to fight by the athletic commission before Friday’s weigh-in. Around the time of McGregor’s hearing, the promotion finally announced that Holloway would be replaced by New Yorker Iaquinta. Because he didn’t meet the necessary weight limit, Iaquinta will not be eligible to win the title.

White said Friday morning that he had been in contact with McGregor and that the fighter had attempted to justify his actions. White said the fracas was not prompted by McGregor getting stripped of his lightweight belt this week but rather by previous bad feelings between McGregor’s camp and Nurmagomedov, the Russian fighter scheduled to face Holloway for McGregor’s vacated belt in Saturday’s main event. Nurmagomedov was filmed in a confrontation at a hotel with Lobov, the McGregor friend, this week.

“Conor and I talked through text yesterday, obviously the worst conversation we have ever had, ” White said during a Friday morning appearance on Fox Sports 1’s “First Things First,” adding that the conversation took place before McGregor turned himself in. “It’s not that I don’t think he understood what happened, it’s just … he justified it, it was justified to him. … [He thought] it had to be done.”

White said McGregor and his crew — “20 hoodlums they flew in from Ireland” — gained access to the arena thanks to “people on the inside” who were covering the event for McGregor’s company. The confrontation came when the McGregor entourage attacked the bus filled with fighters and staffers, including Nurmagomedov.

“These buses are full of a ton of fighters and their cornermen,” White said. “And they’re just throwing things into the windows not caring who they hit. … They hit Mike Chiesa. Mike Chiesa has nothing to do with this. … Many of the fighters and cornermen have nothing to do with this situation.”

In an appearance later Friday on ESPN’s “Get Up!” White said the incident was not a stunt meant to generate publicity for UFC, which has lost a number of star fighters in recent months to boxing (McGregor fought Floyd Mayweather Jr. in a lucrative bout last year), pro wrestling (Ronda Rousey) and a combination of wrestling and failed doping tests (Brock Lesnar).

“This is the last stunt on earth we would ever pull. I mean, this is embarrassing for the sport and obviously for the UFC,” White said. “This is the furthest thing from a stunt.”

White added that McGregor won’t be getting any sort of bailout from UFC.

“Normally, yes — I would dive right in and do everything in my power to help one of my guys,” White said on the ESPN show. “But not in this situation. He came into the Barclays Center, attacked our fighters, and attacked my staff with a bunch of guys — no. You don’t get my help on this one.”

Videos posted to social media showed a chaotic scene Thursday, with at least one guardrail being flung and general disorder. (A fuller video of the bus incident is here; it contains explicit language.)

“Conor went bananas and put a beating on the van that we were in,” Chiesa’s coach Rick Little told MMA Junkie. “A million security guards had to restrain him. Mike’s cut up now. He’s got marks on him, for sure. I don’t think too serious. Everything happened so fast, it was just like we got jumped.”

Little told the site that his fighter had been cut by shattered glass. And some media members at the arena reported that the target of McGrergor’s ire was apparently Nurmagomedov, who seemed to believe that was the case.

“I am laughing inside,” the Russian told MMAFighting’s Ariel Helwani. “You broke window? Why? Come inside. If you real gangster why don’t you come inside? This is big history gangster place. Brooklyn. You want to talk to me? Send me location. I am going to come. No problem.”

White on Thursday called the incident the most despicable thing in UFC history, according to ESPN’s Okamoto.

“You want to grab 30 [expletive] friends and come down here and do what you did today?” White said in a video posted by Okamoto. “It’s disgusting. And I don’t think anybody is going to be huge Conor McGregor fans after this. I don’t know if he’s on drugs or what his deal is, but to come and do this and act like this?”

White had announced earlier this week there would be “no interim champ” following Saturday’s scheduled lightweight main event between Holloway and Nurmagomedov, before Holloway was scratched. “When this fight is over, champion,” White said at a news conference, gesturing to Nurmagomedov and Holloway. “One of these guys will be the champion.”

This news was not taken well by McGregor, the previous permanent holder of that title.

“You’s’ll strip me of nothing,” he tweeted very early Thursday morning, before calling UFC officials an unprintable word.

McGregor won the lightweight title by defeating Eddie Alvarez at UFC 205 in a November 2016 bout but stepped away from the octagon to train for last year’s lucrative boxing match against Floyd Mayweather. Tony Ferguson stepped in to win an interim lightweight belt in McGregor’s absence.

“Tony Ferguson isn’t being stripped. The only person here who is losing a belt is Conor. Conor’s losing the belt, these two are fighting for the belt,” White said at the news conference.

Before Thursday’s fracas, White insisted that McGregor “is coming back this year, 100 percent,” adding, “We’ll see how this thing plays out [with the lightweight title], and we’ll go from there.”

He later reiterated that stance on Fox Sports’ “UFC Tonight,” saying: “Conor does want to fight. Conor and I have been talking a lot. Conor does want to come back, he does want to fight, so he will fight this year.”

That was before Thursday’s events, which figure to forever change McGregor’s relationship with UFC.

Read more from The Post:

MMA fighter’s front flip off KO’d opponent’s body leads to suspension, apology

Ronda Rousey put through a table by Stephanie McMahon ahead of WrestleMania

Fired over an Instagram post and a rumor, Saints cheerleader could force NFL to address double standard

An ace at Augusta had Jack Nicklaus in tears. Another dislocated Tony Finau’s ankle.