Changing course after an unwelcome national uproar, the Virginia Senate adopted a revised bill on Tuesday that still requires doctors to perform an ultrasound on women before they have an abortion, but also says that women cannot be forced to have an invasive vaginal ultrasound.

Gov. Bob McDonnell demanded the revisions last week, and their acceptance on Tuesday all but assured the state’s adoption of the ultrasound requirement. The original bill set off protests from women’s groups and others. Some critics called it “state rape,” and the plan was mocked on television comedy shows.

The furor has already had an effect in other states considering ultrasound mandates, including Alabama and Idaho, with lawmakers seeking to avoid accusations that they are subjecting women to an unwanted, invasive procedure.

In Virginia, the weakened version passed the Republican-led House last week but faced a battle in the Senate, which is evenly divided between Republicans and Democrats. On Tuesday the bill narrowly passed, 21 to 19, with further amendments that will require it to go back to the House for final approval. The Senate vote came after a bitter debate in which Democrats pleaded with the body not to adopt a bill that they said remained — even with the changes — demeaning to women and insulting to doctors.