Julio Cesar Chavez Jr. was granted a temporary restraining order by a Nevada State Court judge on Tuesday, clearing the way for him to fight Daniel Jacobs on Friday night following weeks of controversy.

Chavez and fellow former middleweight world titlist Jacobs are due to meet in a 12-round super middleweight fight at Talking Stick Resort Arena in Phoenix (DAZN, 9 p.m. ET).

“It was very important for us, especially for Julio Cesar Chavez Jr., to get to this fight against Jacobs without any restriction, so it was very important that this temporary suspension be lifted,” Miguel Leff, Chavez’s lawyer told ESPN. “We will have the opportunity to collect and review the information and when we have everything ready, we will see the case in court, but that will be after Friday’s fight.”

The bout had been in jeopardy for weeks, and former two-time world title challenger Gabriel Rosado, scheduled to box on the undercard, was on standby to step in if Chavez was not permitted to fight.

Chavez was indefinitely suspended by the Nevada State Athletic Commission over his failure to submit to a random drug test when a collector from the Voluntary Anti-Doping Association showed up on Oct. 24 at the Wild Card Boxing Club in Hollywood, California, where Chavez was training, and asked for a urine sample. Chavez declined to provide one.

Under World Anti-Doping Association rules, refusing to submit to a test can result in the same penalty as failing a test, so the Nevada commission suspended him. Matchroom Boxing promoter Eddie Hearn initially planned to hold Jacobs-Chavez at the MGM Grand in Las Vegas and put the date on hold with the commission. At that point, the commission, per its rules, elected to activate its enhanced drug testing protocol with VADA handling the collection.

The commission decided to use enhanced drug testing because of Chavez’s past in Nevada, where he has twice failed tests for banned substances. When Nevada suspended Chavez, Hearn moved the fight to Phoenix, setting up a standoff between the Nevada commission and the Arizona Boxing & Mixed Martial Arts Commission.

Chavez (51-3-1, 33 KOs), 33, of Mexico, ultimately sued the Nevada commission and won the temporary restraining order when Nevada State Judge Jim Crockett ordered the Nevada commission to lift the suspension, at least until a date to review his case is determined.

Arizona was scheduled to discuss the issue at a commission meeting on Wednesday, but now it won’t need to because Crockett, in his ruling, wrote that the Nevada commission lacked jurisdiction because Chavez was not licensed there, was not yet an applicant for a license and “did not consent to be bound by Defendants mandatory drug testing policy that was published on its website and directed only to licensees of the agency. The court further finds that Chavez subsequently passed a drug test administered by the Arizona Boxing Commission for which he holds a license.”

Hearn said all he did was make the fight and was not involved in the court battle.

“We don’t represent him, but they got an injunction and he’s no longer suspended,” Hearn said. “He’s been licensed to fight in Arizona for some time, but this completely clears up the matter and we look forward to a huge show with over 10,000 [in attendance] on Friday.”

Typically, when a fighter is suspended in one state other states honor the suspension, but Hearn’s decision to move the fight from Las Vegas to Phoenix — venue shopping, according to the Nevada commission and against Nevada rules and the federal Muhammad Ali Reform Act — angered the Nevada commission to the point that Hearn is risking his ability to get a 2020 license there to promote fights.

“If someone wants to have a grudge, I mean, that won’t be the first time in boxing someone had a grudge,” Hearn said. “We’ve done everything completely by the book. The fact is, if Arizona didn’t license Julio Cesar Chavez Jr., of course, we wouldn’t put the fight on. That’s why we’ve had Gabriel Rosado on the card, signed to stand in, if there was an issue. But Chavez has fought his own battle. It had nothing to do with us. We don’t represent Julio Cesar Chavez Jr. We have a contract with him to take part in a fight with Daniel Jacobs, and if he’s licensed, we can’t just rip that contract up and say, ‘Sorry mate, we’re not going through with the fight.’ The fact is he’s gone to court and won in court, and he’s no longer suspended. We’re doing the fight, and we’re happy to do the fight.

“We’ve done nothing wrong. The argument was, ‘Oh, you’re going to do a fight with a suspended fighter in another state.’ I mean, now, that’s completely, factually incorrect. So in that respect, it puts the matter to bed from a Matchroom point of view. How Chavez deals with it from here, obviously he’s his own fighter, he’s got his own promoter, he’s got his own manager. That’s not really my business. All I know is he’s not suspended in any other state, and he’s licensed by Arizona. Onward we go.”

The Nevada commission declined to comment on the situation. Arizona commission chairman Scott Fletcher told ESPN in a statement that he was aware of the Nevada court decision to grant to the temporary restraining order and that “based on the court’s ruling we are looking forward to a great event this Friday at the Talking Stick Resort Arena in Phoenix. Both athletes have tested negative [in prefight testing handled by Drug Free Sport] for all performance enhancing drugs, masking agents and illicit drugs and will be subject to additional tests.”

Two-time middleweight titlist Jacobs (35-3, 29 KOs), 32, of Brooklyn, New York, is making his super middleweight debut after losing a decision to Canelo Alvarez in their middleweight title unification fight in May.

Since losing by shutout decision to Alvarez in May 2017 in a fight in which he did not appear to even try, Chavez has fought just once. He scored a first-round knockout of journeyman Evert Bravo in a light heavyweight fight on Aug. 10 in Mexico.

ESPN’s Steve Kim and Salvador Rodriguez contributed to this report.