The California Supreme Court on Thursday handed down a mixed-bag decision for Facebook, Instagram and Twitter in a case centered on whether criminal defendants can have access to social media posts by witnesses and others involved in an alleged crime.

In a unanimous 59-page decision written by Chief Justice Tani Cantil-Sakauye, the court ruled that social media service providers must comply when receiving a subpoena for posts marked as public by the user. The court rejected arguments by the companies that they have discretion not to comply under the federal Stored Communications Act.

But the court also agreed with the companies involved in the case, Facebook v. Superior Court (Hunter), that posts marked as private—or shared to a limited number of followers or friends—generally may not be disclosed to criminal defendants under the SCA, even if the intended recipients were a large group of people.

“The legislative history [of the SCA] suggests that Congress intended to exclude from the scope of the lawful consent exception communications configured by the user to be accessible to only specified recipients,” Cantil-Sakauye wrote.

“There is no indication in the legislative history of any intent to do otherwise in the case of communications sent by a user to a large number of recipients who, even in 1986 when the act was adopted, could have shared such communications with others who were not intended by the original poster to be recipients.”

The court, however, punted on the larger question of whether the SCA's prohibition on disclosing private posts in such cases is unconstitutional, or whether they may be disclosed under the “lawful consent exception” contained in Section 2702 of the law. Instead, it directed the trial court to first determine which posts configured as public may be turned over.

“Ultimately, whether any given communication sought by the subpoenas in this case falls within the lawful consent exception of Section 2702(b)(3), and must be disclosed by a provider pursuant to a subpoena, cannot be resolved on this record,” the chief justice wrote.

“Because the parties have not until recently focused on the need to consider the configuration of communications or accounts, along with related issues concerning the reconfiguration or deletion history of the communications at issue, the record before us is incomplete in these respects,” she added.

Riana Pfefferkorn, a fellow at Stanford Law School's Center for Internet and Society, said the decision is “a win for users, because it correctly reads the SCA as being protective of their privacy.” But she also acknowledged that it does not resolve the larger questions of if or when defense counsel may gain access to private posts on social media.

The only direct benefit for criminal defense lawyers from the decision, Pfefferkorn said, is that it requires social media providers to package up more nicely public data that lawyers can already access. “Providers are now on notice that they're presumably going to get a lot more of these types of subpoenas … and that's going to be potentially irksome for providers,” she added.

The underlying case stems from gang-related murder indictments against two men, Lee Sullivan and Derrick Hunter, who are accused of killing a man and seriously injuring a minor during a 2013 drive-by shooting in San Francisco.

Social media has been a focal point of the case. Hunter's 14-year-old brother, who was found guilty of murder and attempted murder in juvenile court, told police he shot the victim as retribution for threats on Facebook and Instagram. Prosecutors also used social media records as evidence before the grand jury.

The defense counsel also hoped that social media data would help swing the case in their favor, and sought private posts by Sullivan's ex-girlfriend in an attempt to show that jealousy motivated her to provide testimony against him.

The trial court ruled in favor of the defendants gaining access to those records, over the objections of the social media companies. But the First District Court of Appeal in 2015 overruled that decision, holding that the defendants had not made a sufficient showing that they had a constitutional right to access the records.

The defendants have maintained throughout the case that they have a constitutional right to the posts under the Fifth Amendment's due process principle, as well as their rights to prepare an effective defense under the Sixth Amendment. They argued that to the extent the SCA impedes those rights, it should be declared unconstitutional.

A spokesman for Facebook, which also owns Instagram, said the company is reviewing the decision. Arguing on behalf of the companies in the case was Joshua Lipshutz of Gibson, Dunn & Crutcher. Twitter declined to comment.

Arguing on behalf of the criminal defendants at the California Supreme Court was San Francisco-based attorney Susan Kaplan. She did not immediately respond to a voicemail seeking comment on the decision.

The California Supreme Court is also considering another case involving Facebook that touches on the issue of how the SCA applies in criminal proceedings. That case, Facebook v. Superior Court (Touchstone), raises the question of whether a court may compel a victim to produce private social media posts. The case has been fully briefed and is pending oral argument.