The Virginia Senate on Tuesday narrowly rejected a bill to end tenure-related job protections for public school teachers, dealing a significant setback to Gov. Robert F. McDonnell’s education agenda.

The 20 to 18 vote came one day after a companion bill had passed comfortably in the Republican-dominated House. In the Senate, which is evenly divided between the parties, all 20 Democrats opposed the bill. Two Republicans did not vote, effectively denying passage.

The House version could still be considered by the Senate. But to reverse Tuesday’s outcome, McDonnell (R) and his supporters will need to round up more votes.

Despite the Senate defeat, “the governor continues to be committed to this important education reform,” McDonnell spokesman Jeff Caldwell said. “This issue still has a long way to go, and the administration is committed to strongly advocating for the successful House version of this legislation.”

The bill aims to ease dismissal of ineffective teachers. It would give administrators power to let veteran teachers go without demonstrating just cause — a provision that has drawn intense resistance from labor leaders and their allies in the General Assembly.

In general, Democrats have ­opposed the legislation. Most Republicans have supported it. However, in the 55 to 43 House vote on Monday, 12 Republican delegates crossed party lines to oppose the bill. One House Democrat voted for it.

On Tuesday, Sen. Mark Obenshain (R-Harrisonburg) spoke for the bill in floor debate.

Under the current law, he said, it’s possible to fire a poor teacher — but it’s difficult and expensive. Obenshain argued that easing dismissal of underperformers would “help teachers who have long been frustrated about those . . . in classrooms next door and down the hall who are not pulling their weight.”

Several Democrats spoke against the bill, saying it would disproportionately impact poorer areas of the state where low salaries already make it difficult to attract teachers.

“I really want to improve the teachers in Virginia. I want our students to be the best in the world; I want them to be competitive in the global economy,” said Sen. Yvonne B. Miller (D-Norfolk), “but I don’t see this as a way to do it.”

Sen. Thomas K. Norment Jr. (James City) was one of the two Republicans who did not vote. He said during the floor debate he could not consider the measure without thinking of his daughter, a kindergarten teacher in Williamsburg.

“When she e-mails me this morning and says, ‘Dad, Happy Valentine’s Day, I love you. Don’t stick it to the teachers’ — it makes me pause,” Norment said.

Teachers currently go through a three-year probation period and then receive “continuing contracts,” which are almost always renewed. McDonnell’s proposal would extend probation to five years and replace continuing contracts with three-year contracts.

At the end of every three years, administrators could decide not to renew a teacher’s contract for any reason. The teacher would not be entitled to due process hearings.

Obenshain said he understood why senators would have reservations about the bill. He said even he felt a little uneasy when he was asked to carry the legislation.

But he told colleagues, “realities are changing” as states across the country scale back teacher job protections.

Tenure reform “may not come right now, it may not come today,” Obenshain said, “but it is coming.”

Since 2009, a dozen states have enacted tenure reforms that explicitly link teachers’ employment status to student achievement, according to the National Council on Teacher Quality, a Washington-based advocacy group.

In Maryland, teachers gain tenure protections after a three-year probation. D.C. public schools eliminated seniority-based job protection under then-Schools Chancellor Michelle A. Rhee.

“This is an exciting time,” said Eric Lerum, vice president for national policy at Students First, an organization that lobbies for tenure reform and rigorous teacher evaluation systems and is led by Rhee.

“So many states are taking this up and really seeing that this is the direction that we can move,” Lerum said.

Connecticut, New Jersey, Missouri, South Dakota and Louisiana are among states considering tenure reform this year. Some proposals make job protections harder to earn; some make the protections easier to lose. Others effectively abolish tenure altogether.

Francine Lawrence, vice president of the American Federation of Teachers, said the union supports evaluating teachers and holding them to high standards. But doing away with tenure — which doesn’t guarantee a job, but a fair hearing before dismissal — does not serve children, she said.

“One of our challenges is attracting quality people to the profession, and to not have any opportunity for due process will not attract quality people.”

Staff writer Anita Kumar contributed to this report.