When members of the State House of Representatives passed a bill ending Connecticut’s death penalty Wednesday night — all but ensuring the success of abolition — they also ended a history of legislative failure.

While the current repeal bill is en route to the desk of Gov. Dannel Malloy, who has pledged to sign it, former Republican Gov. Jodi Rell vetoed a similar bill in 2009 and another passed the Judiciary Committee in 2011, but failed to reach the House floor after two lawmakers withdrew support at the last minute, citing the ongoing trials of the infamous 2007 triple homicide in Cheshire, Conn. A combination of the surge of momentum created by both lawmakers and activists, the amendment to the bill imposing additional restrictions on those who would have previously received the death penalty, and the time elapsed since the Cheshire trials contributed to the success of the 2012 repeal effort.

State Rep. Roland Lemar, a Democrat who represent New Haven, called the bill’s passage a “Herculean effort.” The recent failures to repeal the death penalty followed four other failed attempts in the past two decades, he said.

Years after the Cheshire incident, in which William Petit’s wife and two teenage daughters were murdered and he was badly injured, the trials have loomed large in the debates about repeal in Hartford since 2009.

“The crimes that were committed on that brutal July night were so far out of the range of normal understanding that now, more than three years later, we still find it difficult to accept that they happened in one of our communities,” Rell said in her veto statement in 2009. “I have long believed that there are certain crimes so heinous, so depraved, that society is best served by imposing the ultimate sanction on the criminal.”

The cases — in which both perpetrators, Steven Hayes and Joshua Komisarjevsky, were sentenced to death — figured prominently in the 2011 Connecticut Senate debates. Petit’s testimony against repeal triggered the reversal of two key votes, dooming the bill for the rest of the legislative session.

As the Cheshire trials faded from local and national headlines, lawmakers became more receptive to the arguments made by anti-death penalty advocates, said State Senate Majority Leader Martin Looney, also a New Haven Democrat and a leader of the 2012 repeal effort.

“This year, the [Cheshire murder] trials weren’t taking place concurrently with discussion about legislation,” Lemar said. “[Petit] did not come himself to testify, and senators did not have the consistent reminders of the tragedies in the back of their minds, and that allowed some of them to view it more as a matter of public policy than one of personal vengeance and retribution.”

Looney also cited a “gradual building of momentum” around new information about the death penalty’s administration as a reason for the current bill’s success. In particular, he emphasized the inconsistency in the implementation of the death penalty, with records showing that some individuals on death row have committed crimes that are nearly identical to those of others who were not sentenced to capital punishment.

State Rep. Gary Holder-Winfield, a sponsor of the bill and a New Haven Democrat, also attributed the bill’s increased support in part to the work of outside groups, including the Yale College Democrats.

“When I came in 2009, the only voices you were hearing were the voices of people who wanted to maintain the death penalty,” said, Holder-Winfield, who was a leader of last year’s repeal effort. “The work that Yale students, the NAACP, and others have done has added to the voices of those who want the death penalty abolished.”

Not all who hoped for the death penalty’s repeal were completely satisfied with the final version of the bill, which replaces the death penalty with life in solitary confinement without the possibility of parole.

Both Holder-Winfield and Dems President Zak Newman ’13 said they were unhappy with this enhanced punishment, which entails additional limitations such as restrictions on visiting hours, but acknowledged that it was necessary in order to ultimately pass the bill. They also said they were dissatisfied with the fact that the bill would not prevent the 11 people on the state’s death row from receiving capital punishment — a feature of the bill that its critics fiercely disputed, arguing that repeal would supply legal ammunition for the appeal of capital sentences of death row inmates.

“Of course it was a compromise. That’s what you do in legislatures — you compromise to get things done,” Holder-Winfield said. “It wouldn’t have passed the Senate without this extra provision.”

Once Malloy signs the bill, Connecticut will be the 17th state, in addition to the District of Columbia, to repeal the death penalty.

Nick Defiesta contributed reporting.