Facebook Inc. has convinced a California appellate court to block a criminal defendant’s attempt to get nonpublic user information from the company about a key trial witness.

The Fourth District Court of Appeal found Tuesday that Lance Touchstone, who is awaiting trial on a charge of attempted murder, can’t compel Facebook to hand over private profile information and messages from the person he allegedly shot. Touchstone’s lawyers want to probe private portions of the victim’s Facebook profile for potentially exculpatory evidence after he had posted publicly about drug use, guns and his desire to rob and shoot people.