A bill aimed at curbing harassment and obstruction outside abortion clinics is on the verge of becoming law, as the Legislature moved with uncharacteristic swiftness following the US Supreme Court’s ruling striking down the state’s “buffer zone” law, which barred protesters from within 35 feet of clinics.

The House passed the bill Wednesday, 116 to 35, following the passage of a slightly different version in the Senate last week. Governor Deval Patrick, who pressed for the legislation, is expected to sign it into law when he receives it, which will probably happen in coming days after a final back and forth between the chambers.

The bill gives police more authority to disperse protesters who have substantially impeded access to a clinic. It then allows law enforcement to require protesters to remain 25 feet away from the driveway or entrance of the facility for eight hours or until the clinic closes for the day.

The legislation also boosts the ability of the attorney general to seek fines and compensatory damages from unlawful protesters.

“The Legislature’s swift action will ensure that people can safely access reproductive health care in Massachusetts without fear of violence or intimidation,” Megan Amundson, executive director of NARAL Pro-Choice Massachusetts, said in a statement.

Martha Walz, president and chief executive of the Planned Parenthood League of Massachusetts, said she was delighted by the vote. “There’s clear recognition of the public safety concerns faced by the staff and patients at women’s reproductive health care centers,” she said.

Walz said she expected both chambers to send the legislation to Patrick next week and said it could serve as a template for other states and cities as they mull responses to the high court’s unanimous decision in the case, McCullen v. Coakley.

The House made one small change to the legislation Wednesday, lowering the amount of some monetary civil penalties for, among other violations, people who by force or threat of force injure or intimidate a person who is trying to come or go from a clinic.

But the House and Senate will need to agree on a final version before the bill can go to the governor.

The high court’s June decision, which cited protesters’ constitutional free speech rights, prompted a quick scramble by top state officials, including Patrick and Attorney General Martha Coakley, and the Legislature to craft a new way to try to protect people entering clinics. They face a looming deadline: Formal legislative sessions for the year are to conclude next Thursday.

“We’re pleased that the legislature is acting so quickly, given the important public safety and reproductive health issues addressed in the Safe Access Bill and look forward to having it on the governor’s desk soon,” Patrick spokeswoman Jesse Mermell said.

Opponents of the legislation said the Legislature was moving far too fast and said this bill, if it becomes law, would be struck down by courts, just as the 2007 Massachusetts buffer zone law was.

“Unfortunately, the attorney general and the governor were intent on ramming it through, and it looks like they’ve succeeded so far,” said Andrew Beckwith, president of the Massachusetts Family Institute. “But there are serious constitutional questions about the bill.”

He said the legislation creates a de facto buffer zone that will not survive scrutiny from the courts.

James F. Driscoll, executive director of the Massachusetts Catholic Conference, which represents the four dioceses in the state, said before the House vote Wednesday he was concerned that the Legislature was “rushing this through at the last minute.”

“If we had just given this some time to play out, we would have known if there is a need for a new law or if everything is fine as is,” he said. “It just seems to be too quick, too rushed.”

Representative James J. Lyons Jr., Republican of Andover, offered many amendments, all rejected, during the course of the debate on the bill. He also urged lawmakers to slow down and repeatedly told his colleagues the bill was unconstitutional.

But backers say a new law is necessary as soon as possible and the bill is narrowly tailored within the guidance given by the Supreme Court.

“We did what the court asked us to do,” Walz said. “This bill is focused exclusively on conduct outside of reproductive health care centers. There’s nothing in this bill relating to speech at all.”

Representative Christopher M. Markey, a Dartmouth Democrat and the House vice chairman of the Joint Committee on the Judiciary, said the bill tried to balance the First Amendment rights of protesters while assuring the safety of the public and people accessing clinics.

“When it comes to these types of constitutional issues, you try and find a balance as best you can,” he said. “I think we’ve done that.”