For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

As California prepared to pass a “sanctuary” law in 2017, a private prison company sent a legal memo about the bill’s impact to Immigration and Customs Enforcement. The memo circulated to the agency’s highest levels, and ICE legal officials cited it in their own analysis of the law. The memo came from the GEO Group, the country’s largest private prison company, which earns a quarter of its revenue from ICE. As of mid-2017, the agency was paying GEO to lock up nearly a third of all people in ICE custody in its immigration detention centers, including two in California.

GEO’s business in California came under threat in June 2017 when Gov. Jerry Brown signed AB 103, a public safety omnibus bill that blocked counties from entering into new federal contracts to detain immigrants and from expanding existing contracts. Five days before the law was signed, a GEO executive vice president emailed Tae Johnson, ICE’s detention chief, and attached a memo that laid out the company’s legal analysis of the bill. Emails show that the memo was quickly circulated to the agency’s highest levels. Those emails were obtained through a Freedom of Information Act request by Democracy Forward, a watchdog group formed after the 2016 election. ICE has refused to release the contents of the GEO memo, claiming it is legally privileged material.

By freezing county-level detention contracts, AB 103 hindered GEO from expanding most of its ICE-related operations in a border state as President Donald Trump’s policies were landing more people in immigration detention than ever before. GEO’s 1,940-bed Adelanto and 400-bed Mesa Verde facilities in Southern California both operate under “intergovernmental service agreements”—a type of contract, often signed quietly and with favorable terms to private detention companies, in which local governments act as intermediaries between prison companies and the federal government.

Within days of being sent, GEO’s memo reached ICE acting director Thomas Homan, top ICE lawyer Tracy Short, and the Department of Homeland Security’s office of the general counsel, which pledged to support ICE in opposing the California bill. Short also forwarded the memo to Tom Blank, the chief of staff to then-DHS Secretary John Kelly, along with other information “urging [Kelly] to ask the Attorney General to seek declaratory relief against California AB 103, the California budget measure that would paralyze immigration detention contracting in that state,” he wrote.

In a separate email to the Department of Justice, Short wrote that AB 103 would have a “significant, adverse impact” on ICE operations. He also noted that some of ICE’s interpretation of the law had come from the private prison company. “As a caveat, some of the legal conclusions contained in the analysis were provided by GEO Group, the detention management company which administers many of the affected detention facilities in California,” Short wrote. “They will likely merit some further scrutiny to ensure that they are consistent with the federal government’s interpretation of the law.”

Asked about the memo, GEO spokesperson Pablo Paez suggested that ICE had asked the company for its legal analysis of AB 103. “Our company’s representatives have frequent communications with our government customers regarding a variety of issues and topics,” Paez said in a statement. “Requests for information from our government customers are not unusual, and our company always endeavors to respond to such requests promptly and thoroughly.”

ICE would not answer questions about the memo or its contents. In a statement, spokeswoman Sarah Rodriguez suggested that this kind of contact between GEO and ICE is normal: “Once a service provider is selected, regular communication between personnel at various levels related to detention services may be necessary and is entirely appropriate.”

It’s unclear if GEO’s memo was seen by the secretary of homeland security or then-Attorney General Jeff Sessions, or if it influenced the Justice Department’s lawsuit against California sanctuary laws. The federal government’s complaint, filed in March, did not challenge the section of AB 103 that banned the expansion of county-level detention contracts. Instead, it focused on a requirement that the state attorney general inspect any facilities where detained immigrants are held. GEO’s facilities haven’t fared well in similar inspections. A surprise inspection of Adelanto by a federal watchdog agency in May turned up evidence of systemic problems, including monthslong wait times for medical care, guards who mocked detainees who had attempted suicide, and the overuse of solitary confinement. In its suit against California, the Trump administration argued that state inspections of immigration facilities would improperly interfere with “law-enforcement efforts.”

The emails reveal the easy access to powerful homeland security officials GEO enjoys. That access doesn’t just come from being one of the agency’s most important contractors; it’s also due to the company’s revolving-door hires—including David Venturella, GEO’s senior vice president of business development, whose office sent the company’s memo to ICE and who was involved in discussions about whether to share the memo with the DOJ, emails show. Venturella joined GEO in 2012. Before that, he was the boss of ICE’s Enforcement and Removal Operations office, the branch of the agency that carries out both detention and deportation.

In a statement, Charisma Troiano, press secretary for Democracy Forward, pointed to the $225,000 a GEO subsidiary donated to a super-PAC supporting Trump’s 2016 campaign, and its $250,000 gift to Trump’s inaugural fund, as potential sources of GEO’s influence within ICE. “Now we see what they got: An Administration that has granted the GEO Group privileged access and opportunities for input on important public policy decisions from which it stands to profit,” Troiano said.

In July, a federal judge in Sacramento denied the government’s request for an injunction against AB 103 and California’s other sanctuary laws. The DOJ has appealed that decision, and its broader effort to get the sanctuary laws thrown out is on hold. Meanwhile, California Attorney General Xavier Becerra had inspected at least five immigration detention centers as of November 2017 and initiated reviews of Adelanto and Mesa Verde.