U.S. District Judge Manuel Real, in a ruling issued Thursday, found that the Americans For Prosperity Foundation, a 501(c)(3) charity organization, can ignore Harris' demand to turn over the names and addresses of those who have donated more than $5,000.
Such disclosure, Real wrote, "chills the exercise of [the group]'s 1st Amendment freedoms to speak anonymously and to engage in expressive association."
David Beltran, a spokesman for Harris, said the attorney general will now take the case to the the 9th Circuit Court of Appeals.
The lawsuit was filed by the Arlington, Va.-based nonprofit in December 2014, after Harris' office demanded the group submit its donor list or risk losing its state-sanctioned ability to raise money in California.
The attorney general said that long-standing state law requires charities to submit donor information, and that officials ensure that the information isn't disclosed to the public. But in his ruling, Real cast doubt on the state Department of Justice's ability to not publish the donor list by mistake.
"The attorney general's current approach to confidentiality obviously and profoundly risks disclosure," he wrote.
The judge also pointed out that the Americans For Prosperity Foundation had routinely made annual charity filings with the state since the early 2000s and was never asked for the donor list from its IRS Form 990 until March 2013.
Both the group and its sister organization, Americans For Prosperity, have long ties to billionaire industrialists David and Charles Koch. David Koch is chairman of the foundation's board. Americans For Prosperity has played a major role in advocating for conservative causes in state and national politics, while the foundation — which filed the lawsuit against Harris — has more restrictions on how it spends money in relation to politics. Its donors' contributions, though, are tax-free.
Critics have said the Koch brothers' support of these and other groups highlights the problem of opaque laws governing donor disclosure by politically minded nonprofits.
Derek Shaffer, an attorney for the Americans for Prosperity Foundation, released a statement on behalf of the organization praising the court for its ruling.
"The Foundation is gratified that Judge Real has vindicated its First Amendment right to resist the California Attorney General's demand that all charities disclose the names and addresses of all of their major donors nationwide. We hope this important victory will enable Americans, even in the face of governmental overreach, to retain their freedom, privacy and security as they support charities of their choosing."
Beltran, the spokesman for the attorney general, said the filing of IRS donor forms "is a long-standing requirement that has helped attorneys general for more than a decade protect taxpayers against fraud."
In court, state lawyers argued that the donor documents allow investigators to track improper loans and unfair business practices by nonprofits. But attorneys for the Americans For Prosperity Foundation countered that donors feared for their safety if their identities were somehow revealed. Judge Real agreed.
"Once AFP's donor information is disclosed, it cannot be clawed back," he wrote in his ruling.
For the record
9:51 p.m.: A previous version of this article referred to the Center for Competitive Politics as the Center for Responsive Politics.
Thursday's ruling stands at odds with a lawsuit filed against Harris over disclosure of donors to a similar nonprofit, the Center for Competitive Politics. In that case, however, a federal judge agreed with Harris.
Last November, the U.S. Supreme Court refused to hear the organization's appeal.