The Supreme Court on Thursday struck down a Massachusetts law that set 35-foot buffer zones around abortion clinics, saying it violated the First Amendment free speech rights of protesters.

The unanimous decision is a victory for anti-abortion activists and even some liberal-leaning groups who feared the law, if upheld, could make it more difficult for striking workers to picket outside their workplace.

Chief Justice John Roberts, in writing for the court, said “one-on-one communication” and the handing out of leaflets are among the most effective and cherished forms of political discourse.

“When the government makes it more difficult to engage in these modes of communication, it imposes an especially significant First Amendment burden,” he said.

The ruling doesn’t ban buffer zones entirely, as it said states and local governments still can pass laws that specifically ensure access to clinics. But the justices said such laws must protect free speech on public streets and sidewalks, a provision not guaranteed in the Massachusetts law.

Massachusetts instituted its 2007 buffer zone law after several abortion clinics in the state complained that protesters, activists and others repeatedly were blocking — and sometimes harassing — patients as they entered their facilities.

The state said in some instances before the law was enacted, protesters had thrown anti-abortion leaflets into car windows and sometimes poked their heads or hands inside the vehicles.

Eleanor McCullen, a 77-year-old anti-abortion activist, challenged the law on the grounds it violated her free speech rights.

Massachusetts defended its law by arguing it would be extremely difficult to write a statute that would prohibit some types of speech, such has yelling, while allowing others, such as quiet, peaceful dialogue.

Lower courts had upheld the law on the grounds it applied equally to all groups and didn't discriminate against anti-abortion or pro-abortion rights activists.

But the Supreme Court said the state must find less restrictive ways to ensure patients have safe access to the clinics while protecting free-speech rights of peaceful anti-abortion protesters and others gathered outside.

"For a problem shown to arise only once a week in one city at one clinic, creating 35-foot buffer zones at every clinic across the commonwealth [of Massachusetts] is hardly a narrowly tailored solution," Roberts said.

“The commonwealth has available to it a variety of approaches that appear capable of serving its interests, without excluding individuals from areas historically open for speech and debate.”

McCullen said she was “delighted” with the decision.

“Today’s ruling means I can offer loving help to a woman who wants it, and neither of us will go to jail for the discussion,” McCullen said. "I’m thankful to God that the court has protected my right to engage in kind, hopeful discussions with women who feel they have nowhere else to turn.”

McCullen attracted an unusual coalition of supporters, as the the AFL-CIO labor federation, worried that a ruling to uphold buffer zones could make it more difficult for striking workers to picket outside their workplace, filed a brief backing her lawsuit.

Sen. Ted Cruz, R-Texas, said the decision “vindicated the First Amendment rights of citizens who peacefully counseled women about alternatives to abortion.”

“Once again, the Supreme Court unanimously rejected the litigating position of the Obama administration, which opposed free speech rights in an amicus brief” in support of the law, said the conservative lawmaker.

The ruling left intact a high court decision from 2000 that upheld a floating, eight-foot buffer zone in Colorado. But the court said its not aware of any other state with such a strict buffer zone as Massachusetts, though five cities nationwide do have similar laws.

Abortion-rights advocates worry the ruling will discourage other states and local governments from considering buffer zones around abortion clinics, a move they say would put women seeking counseling and treatment in a vulnerable and possibly dangerous position.

“This decision shows a troubling level of disregard for American women, who should be able to make carefully considered, private medical decisions without running a gauntlet of harassing and threatening protesters,” said Cecile Richards, president of Planned Parenthood Federation of America.

“Today’s ruling isn’t the end of the story — it can’t be,” added Martha “Marty” Walz, president and CEO of Planned Parenthood League of Massachusetts.

Past Supreme Courts have ruled the First Amendment doesn't guarantee a person the right to express his or her opinions at all times and places, or in any manner that may be desired.

The high court three years ago ruled that the controversial Westboro Baptist Church of Topeka, Kan., could protest outside military funerals, provided it did so on public property. But justices left the decision of how far protesters should stay away from an event to local authorities. In the case, Westboro protesters said they abided by a police request to stay 1,000 feet away from the funeral.

The Supreme Court prohibits protests and demonstrations on its grounds but allows for such activity, with conditions, on adjacent public sidewalks.

This article has been updated.