Sheldon Adelson, the billionaire Republican casino mogul, is associated with a singular political project: his long-running mission to uproot the U.S. Embassy in Tel Aviv and plant it in Jerusalem instead.

But there’s a second project — lower profile, but no less of a passionate priority — that Adelson has long been gunning for, and that’s his war against online gambling. Adelson’s casino empire is comprised of brick-and-mortar establishments, to which online gambling is a major threat, but Adelson says he is at war with online gambling for the good of society: Gambling in casinos is one thing, but gambling online is a public health nightmare.

Adelson’s crusade against online gambling led to an attorney general recusal, tense debates within the Justice Department, and a standoff with the White House that culminated with an extraordinary reversal of policy in the middle of the government shutdown, when the Trump administration issued the legal opinion against online gambling that Adelson had long sought.

His mission dates back to 2011, when the Justice Department issued an opinion clarifying that the Wire Act, a 1961 federal statute designed to stop interstate betting, only applies to sports betting and no other forms of gambling. The opinion paved the way for states to begin establishing legalized online gambling, so long as they did not create interstate sports betting arrangements. Today, Nevada, New Jersey, Delaware, and Pennsylvania have all legalized online gambling, and 22 states have pending gambling legislation for a mix of casino, poker, and sports.

For years, Adelson has poured money into lobbying efforts to override the Justice Department opinion, corralling his closest congressional allies to pass legislation, bluntly called the Restoration of America’s Wire Act, or RAWA. Adelson pledged to spend “whatever it takes” to ban online gambling, claiming his motives are purely altruistic, an effort to prevent the exploitation of children and the poor. “I am in favor of [gambling] as a form of entertainment, but I am not in favor of it exploiting the world’s most vulnerable people,” he said of his opposition. “I know I am a Republican, and I am not supposed to be socially sensitive, but I am very socially sensitive.”

In 2014, Adelson began bankrolling a new advocacy group called the Coalition to Stop Internet Gambling, and that same year, Sen. Lindsey Graham, R-S.C., and Rep. Jason Chaffetz, R-Utah, first introduced RAWA in Congress. Graham had not previously been a vocal opponent against online gaming, but in 2013, Adelson began significantly scaling up his political contributions to the South Carolina senator, even hosting a high-dollar fundraiser for Graham at his Las Vegas Venetian hotel. Also in 2014, Adelson emerged as the top GOP donor, giving $13.2 million to help Republicans take control of the Senate.

Despite all this, RAWA gained little traction. Republicans felt uncomfortable pushing for a new federal ban, and many Democrats were both interested in the new tax revenue streams that could be directed toward things like public education, and suspicious of helping a pet cause of Adelson.

“Adelson worked with [John] Boehner, [Harry] Reid, and Chaffetz for years trying to move legislation on this, and wasn’t able to get so much as even a hearing in the committees of jurisdiction,” said one Republican lobbyist, referring to the House and Senate judiciary committees. “He also tried to get [RAWA] inserted in must-pass omnibus legislation, but they could never get it through. Lawmakers knew it would look terrible to pass a bill that couldn’t even get a hearing in the committees of jurisdiction.”

RAWA did manage to get one House Oversight Committee hearing in 2015 when Chaffetz was serving as chair, but the proceedings backfired, with both Democrats and Republicans challenging the witness testimony and voicing opposition to the legislation. Most Republicans opposed RAWA on the basis that it’s an intrusion on states’ rights. Rep. Thomas Massie, R-Ky., noted that if RAWA passed, it could pave the way for a national ban on firearms. Rep. Elijah Cummings,D-Md., came right out and said this whole debate was “about money” — namely the profit margins of brick-and-mortar casinos.

But Adelson was not deterred and poured more than $83 million into Republican races in the 2016 cycle, including at least $20 million to elect Donald Trump.

Shortly after the inauguration, at a small dinner at the White House, Adelson, accompanied by his wife, brought up two issues he said were extremely important to him: relocating the U.S Embassy in Israel, and online gambling, according to two gaming industry sources who learned of the dinner. A spokesperson for Adelson did not return request for comment.

In January 2017, during his Senate confirmation hearing, Jeff Sessions testified that he was “shocked” by the 2011 Justice Department opinion on online gaming, and would “revisit it” as attorney general. The question had been put to him by Graham.

A month later, a law firm headed by Charles Cooper, a former lobbyist for Adelson’s Coalition to Stop Internet Gambling, drafted a legal memo outlining why the 2011 Wire Act opinion was incorrect. By April, as reported by the Wall Street Journal, an attorney, Darryl Nirenberg, who has worked as a registered lobbyist for Adelson for the past two decades, delivered the legal memo to a top-ranking official at the Justice Department. By May, the department’s criminal division forwarded the Cooper memo to the Office of Legal Counsel and asked them to “reconsider” their 2011 stance.

Then came June, and Sessions hired Cooper, his longtime friend, to personally represent him in the ongoing investigations into Russian interference in the 2016 election. By July, Sessions announced that he would recuse himself from all gambling matters, given the involvement of his own lawyer.

That left the online gambling issues under the jurisdiction of Deputy Attorney General Rod Rosenstein, just like when Sessions recused himself from the special counsel probe into Russia, also for conflicts of interest.

According to people close to Rosenstein, the deputy attorney general wanted little to do with the gambling brouhaha. “We’ve checked in over the last two years with Rod Rosenstein and he’s consistently said he has no interest in this issue, that there’s more important issues going on,” said one gaming industry executive who opposes the ban.

Adelson hadn’t fully given up on Congress, and in 2017, Rep. Charlie Dent, R-Pa., tried to squeeze language banning online gambling into appropriations bills. He was unsuccessful, and Dent ultimately resigned from Congress in the spring of 2018.

But finally, Adelson found his golden opportunity, in the middle of the five-week government shutdown, which coincided with the transition between U.S. attorneys general. The new nominee to lead the Justice Department, William Barr, is a well-known, staunch advocate for states’ rights, and supporters of banning online gambling knew his confirmation would make overturning the 2011 opinion that much more difficult.

Barr made his opposition to revising the 2011 memo known during his prep time for his confirmation hearings, people familiar with the deliberations said, which is why Graham ended up not asking him any questions about it, unlike the questions Graham posed to Sessions during his 2017 hearings. Asked whether the senator had advance knowledge of Barr’s stance on the question, Graham’s spokesperson did not respond directly to the question, and instead forwarded a public statement praising the new Wire Act policy.

Barr was asked about his views on enforcing marijuana laws, and he pledged in his confirmation hearing “to not go after companies” that had been relying on a separate Obama-era memo that said the Justice Department would not prosecute companies in states that legalized the drug. Sessions had overturned that memo at the start of 2018.

Knowing both Barr’s position on the Wire Act memo and that Barr was planning to give a states’ rights defense of marijuana legalization at his confirmation hearing, Justice Department officials scrambled. Acting Attorney General Matt Whitaker and other Justice officials met with their White House counterparts and described the plan to overturn the previous memo. White House officials, according to sources briefed on the meeting, advised caution, but ultimately left the decision to the Justice Department. The night before Barr’s hearing, the Justice Department circulated a new legal memo attributed to Steven Engel, an assistant attorney general in the Office of Legal Counsel. That document conspicuously lacked a signature, leading some to wonder if this was even real or just a draft.

The circulated opinion was dated November 2, 2018, but released publicly on January 14, raising further questions about whether it was a draft or was official. The new memo insisted that most forms of online gambling are in fact illegal under the Wire Act, and that this new analysis “supersedes and replaces” the 2011 opinion on the subject. Observers noted that much of the new opinion mirrored arguments and language reflected in the Cooper memo submitted to the Justice Department in 2017. On January 15, the agency circulated a memo to U.S attorneys, Assistant Attorneys General, and the FBI Director, announcing their new Wire Act position.

A spokesperson for the Justice Department did not return request for comment.

Blanche Lincoln, the former Democratic senator from Arkansas and a current lobbyist for Adelson’s Coalition to Stop Internet Gambling, praised the Justice Department for its new legal opinion. “Today’s landmark action to rightfully restore the Wire Act is a win for parents, children, and other vulnerable populations,” she said in a statement.

Adelson’s company, Las Vegas Sands, has paid Lincoln’s lobbying firm $820,000 since 2014, according to federal disclosures.

Ron Reese, a spokesperson for Adelson, did not answer questions about the casino mogul’s involvement with the new Justice Department opinion or his general reaction to it. In a statement to the Washington Post, Reese claimed that the new Justice Department opinion would have “little or no impact” on Las Vegas Sands.

Sen. Mazie Hirono, a Democrat from Hawaii who sits on the Judiciary Committee, told The Intercept that the online gambling issue has not been a real focus in Congress. “I really don’t know who, besides Sheldon Adelson, was supporting the ban. It’s not as though it’s hit our radar screen. In my view, the world is in flames right now with so many other Trump [things],” she said. Hawaii and Utah are the only states that outright ban online gambling, and in 2015, Chaffetz tried to argue that a federal ban on online gambling would serve to further protect states like Utah and Hawaii.