PHOENIX — Rejecting claims of privilege, a federal judge on Wednesday ordered Gov. Jan Brewer to turn over internal documents and memos leading up to her decision to deny driver’s licenses to “dreamers.”

Judge David Campbell ruled the documents are “highly relevant” to the claim by civil-rights groups that there were discriminatory motives behind her 2012 executive order. Those documents could help these groups prove their case.

“The government is a party to this case, and its intent in crafting the policy is a primary issue,” the judge wrote.

Campbell also rebuffed claims by Brewer’s lawyers that having to surrender those internal documents hinders the ability of the governor and her staff to have “frank and independent” discussions.

“Arizona has a policy in favor of full and open disclosure, as evidence by Arizona’s Open Meetings Law,” Campbell said, noting that Arizona courts have never recognized a claim of “deliberative process” under state laws.

“Arizona state government officials, therefore, should reasonably expect that their deliberations in crafting the policy are open to public scrutiny,” Campbell wrote.

The documents could prove crucial in helping overturn the policy, paving the way for thousands of dreamers, some of whom already are driving illegally, to finally be licensed.

The fight is over those accepted into the Deferred Action for Childhood Arrivals program, announced in 2012 by the Obama administration.

It allows those brought to this country as children to remain without fear of deportation if they meet certain other requirements. They also are permitted to work legally.

The most recent report from U.S. Citizenship and Immigration Services shows more than 20,000 Arizona residents have applied. Some estimates have said as many as 80,000 may be eligible.

Brewer, in her executive order, said a 1996 state law says licenses are available only to those whose presence in the country is “authorized by federal law.” She said the Obama administration policy confers no legality but simply says that those in the program will not be pursued.

But the lawsuit, filed on behalf of several dreamers, said it’s not that simple.

Jorge Castillo of the Mexican American Legal Defense and Educational Fund said one legal theory is that Brewer, a frequent critic of the president and his immigration policies, engaged in a sort of “reverse engineering.”

The claim is Brewer first decided she did not want to grant licenses to DACA recipients, and then sought a legal reason to justify it.

Adding to the complexity, Brewer’s executive order was crafted to not affect those in other deferred-action programs who had been granted licenses, even though their position was essentially the same as those in the DACA program, which would violate constitutional equal-protection guarantees.

When that disparity was raised by opponents of the state’s action, the Department of Transportation last year revoked the licenses of 505 people in other deferred-action programs.

Castillo said some of the documents Campbell ordered produced should also shed some light on how that 2013 decision was made. But he said that does not legitimize the denial of licenses to DACA recipients even if that change was designed to provide a new defense against the equal-protection claim.

Linton Joaquin of the National Immigration Law Center said Campbell’s order also should give attorneys for the dreamers another opportunity to question state officials, who have refused to answer questions in the past.

The victory for those challenging Brewer’s action was not complete. The judge did allow the state to withhold certain documents that can be identified as protected by attorney-client privilege.

Gubernatorial press aide Andrew Wilder said the state will comply with the order.