WASHINGTON — The Supreme Court on Monday made it harder to prosecute people for threats made on Facebook and other social media, reversing the conviction of a Pennsylvania man who directed brutally violent language against his estranged wife.

Chief Justice John G. Roberts Jr., writing for the majority, said prosecutors must do more than prove that reasonable people would view statements as threats. The defendant’s state of mind matters, the chief justice wrote, though he declined to say just where the legal line is drawn.

Chief Justice Roberts wrote for seven justices, grounding his opinion in criminal-law principles concerning intent rather than the First Amendment’s protection of free speech. The majority opinion was modest, even cryptic.

Justice Samuel A. Alito Jr. voted with the majority, though he said a defendant’s recklessness in making threatening statements should suffice to require a conviction. The majority opinion took no position on that possibility.