WASHINGTON — The former U.N. diplomat accused of helping steal and distribute Republican fundraiser Elliot Broidy's emails is entitled to diplomatic immunity, the U.S. government tells NBC News.

It's the latest blow to Broidy's legal campaign against Qatar and the individuals he says hacked him on its behalf. Several other defendants in lawsuits filed by Broidy including Qatar itself have already convinced the court to dismiss them from the case, which criss-crosses the murky worlds of cybercrime, the Persian Gulf diplomatic crisis and pay-to-play politics in Trump era.

Broidy, the Republican National Committee's former deputy finance chair, is suing Jamal Benomar, a British citizen born in Morocco. Broidy accuses Benomar of being a "key player" in a Qatari scheme to hack Broidy's emails and distribute them to U.S. journalists. The stolen emails exposed how Broidy tried to parlay his access to President Donald Trump into lucrative contracts for his private security company with Saudi Arabia and the United Arab Emirates, Qatar's chief rivals. Qatar denies involvement in the hacking.

The complex civil case took an unexpected turn earlier this year when Benomar, who left the U.N. before the alleged hack, claimed that he is now a Moroccan diplomat, posted to the North African nation's mission to the U.N. Benomar's lawyers argued that he therefore has diplomatic immunity, and sought to have the case dismissed.

But Broidy's lawyers have said Benomar's immunity claims are "without merit." They argued that Benomar only claimed to be a diplomat after Broidy sued him — and that even if he is, his immunity would only cover "official acts" as a diplomat, not unrelated hacking of an American citizen.

Now the State Department is weighing in — and recognizing Benomar's claim to immunity.

A spokesman for U.S. Ambassador to the U.N. Nikki Haley, whose office oversees recognition of U.N. diplomats, says it reviewed Morroco's accreditation of Benomar and its request for immunity to ensure it met requirements in U.S. and international law.

The U.N. secretary-general's special adviser, Jamal Benomar, at a news conference on Oct 13, 2016. Albin Lohr-Jones / Pacific Press/LightRocket via Getty Images file

"Based on this information, we have registered Benomar with diplomatic privileges and immunities," Haley's office, known as the U.S. Mission to the United Nations, said in a written statement.

That determination about Benomar's immunity was also conveyed in writing Wednesday to lawyers on both sides of the case.

A U.S. official, describing the official U.S. position, tells NBC News that Benomar's immunity is not limited to his "official acts" as a diplomat. Rather, the official says the U.S. is recognizing Benomar as having "status immunity" — which means he's protected from civil suits even for conduct unrelated to his service as a Moroccan diplomat. That's because the Moroccans have now accredited Benomar at the rank of "minister plenipotentiary" — a high-level title just below that of an ambassador.

It's unclear whether Benomar has had that rank since becoming a Moroccan diplomat sometime this year, or whether the Moroccans upgraded his status more recently to ensure he'd have full immunity. In court filings, lawyers for Benomar and Broidy have wrangled over his exact rank and when exactly it took effect. The U.S. government says it registered Benomar with diplomatic immunity as of Tuesday.

The Moroccan Mission to the U.N. did not respond to a request for comment.

Benomar's attorney, Abbe Lowell, provided the court Wednesday with emails from Haley's office showing that with his new accreditation in hand, he'll be getting a new diplomatic passport and diplomatic ID card within the next few days.

"The case must be dismissed," wrote Lowell, who frequently represents high-profile clients including Jared Kushner.

Elliott Broidy and Robin Broidy in 2012 Alex J. Berliner / ABImages via AP Images file

But Broidy's lawyer, former Ambassador Lee Wolosky, has provided documentation to the court alleging that Benomar, at the same time as he claimed to be a Moroccan diplomat, was also performing "for-profit work for Qatar." Broidy's lawyers say that allegation, along with Benomar being a permanent resident of the U.S., make him ineligible for legal immunity regardless of what the State Department says.

"The record before the court, and not the statements of spokespeople, will determine how the court will rule," Wolosky tells NBC News. "The record demonstrates that Mr. Benomar, who is alleged to have participated in a hacking conspiracy against a U.S. citizen, is not entitled to status immunity."

But for months, Broidy's lawyers had argued before the court that the State Department's assessment of his immunity would be the final word. His lawyers cited multiple past cases in which courts ruled that "a person's diplomatic status is established when it is recognized by the Department of State" and that "a determination of the Department of State is binding upon the court."

Julian Ku, who teaches international law at Hofstra University and isn't involved in the case, says that ultimately, it's up to the judge in the civil case to determine whether the immunity claim is legally valid. But he says that because diplomatic immunity claims are so rare, the courts generally follow the lead of the U.S. government.

Jamal Benomar, then the U.N. envoy to Yemen, in 2011. Benomar is being sued by Elliott Broidy, a former RNC deputy finance chair. Mohammed Huwais / AFP/Getty Images file

"Most courts will defer to the State Department's views on a question like this," Ku says. "It's not binding, but it's super persuasive."

The U.S. Mission to the U.N., which is part of the State Department, wouldn't comment on Broidy's civil case. But it said that before making its immunity determination, it checked with the Justice Department and is "not aware of any pending criminal charges against Mr. Benomar." In the statement, the mission also said that Haley, who is stepping down as U.N. ambassador later this year, "played no part in reviewing this case."

The U.S. government has little discretion in deciding who should or shouldn't get immunity, but merely reviews the law and documents submitted by the foreign country to see whether the criteria are met. The U.S. generally has to defer to foreign countries to accredit whoever they want as U.N. diplomats because of the United States' obligations as the host country for the U.N. headquarters in New York.

Benomar's claim to be a Moroccan diplomat was particularly surprising given that decades ago, after voicing opposition to Morocco's government, he was arrested there and tortured. He later became a U.N. diplomat who rose through the ranks to become the U.N. special envoy for Yemen.

Although Qatar denies involvement in hacking Broidy's emails, it had an obvious potential motive for trying to embarrass him. At the same time that Broidy and Lebanese-American businessman George Nader were seeking hundreds of millions of dollars in contracts from the UAE and Saudi Arabia, Broidy was orchestrating an extensive lobbying and public relations campaign against Qatar in the United States, emails later published by various U.S. news outlets showed.

Saudi Arabia and the UAE accuse Qatar of funding terrorism and fomenting dissent throughout the region and have been boycotting the tiny gas-rich nation since last year, in a diplomatic crisis that has roiled the Persian Gulf.