A federal judge has ruled that a nonprofit backed by conservative billionaires David and Charles Koch does not have to reveal its donors to Atty. Gen. Kamala Harris in a case that pitted state law governing charities against 1st Amendment rights.

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 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.