The Maryland Senate on Tuesday moved toward a final vote on Gov. Martin O’Malley’s bill to repeal the death penalty after narrowly rejecting an amendment that would have allowed executions of people who kill in schools and child-care centers.

The 24 to 21 defeat of the amendment, which was inspired by the school shooting in Connecticut, clears the way for a Senate vote on the repeal bill Wednesday. The vote is scheduled barring a snowstorm that keeps senators from convening, Senate President Thomas V. Mike Miller Jr. (D-Calvert) said.

Twenty-seven senators — three more than needed — have said they intend to vote for the bill introduced by O’Malley (D). Prospects for passage also are considered strong in the House.

Sen. Allan H. Kittleman (R-Howard) on Tuesday became the second Senate Republican to announce his support. In an interview, Kittleman said that he does not believe the death penalty is an effective deterrent to murder and that he is aware of cases where DNA evidence has turned out to be wrong.

“I don’t want to take the risk of someone being wrongly executed,” he said.

In a debate that has spanned three days, repeal supporters have turned back more than a dozen amendments in the Senate, most of which would have created exceptions for certain categories of killers.

The measure proposed Tuesday to allow executions of those who kill in educational settings came closest to passing.

Sen. Joseph M. Getty (R-Carroll) and other amendment supporters argued that it could be a more effective response to the Newtown, Conn., shootings than gun-control legislation the Senate passed last week. Getty said the provision targeted “these most wretched and violent murders.”

Other amendments turned back in recent days would have created exceptions for people who kill law enforcement officers, who kill while in prison or who commit rape in addition to murder.

Besides Kittleman, 25 Senate Democrats and Sen. Edward R. Reilly (R-Anne Arundel) have indicated that they plan to vote for repeal.

If the legislation passes, Maryland will become the 18th state to repeal the death penalty. Voters might get the final say, however. Opponents have vowed to take advantage of a provision in the state constitution that allows people to petition recently passed laws to the ballot if they collect enough signatures. A public vote on the death penalty repeal would come in November 2014.