A measure to ban abortions based on the sex of a child failed Thursday after proponents were unable to earn enough support in the House, but GOP abortion opponents said they achieved their strategic goal of forcing Democrats to vote against it.

The plan all along, they said, was to use the vote to paint Democrats as disingenuous in their support for women’s rights by arguing that they voted against a bill intended to protect unborn baby girls.

Lawmakers voted 246 to 168 on the Prenatal Nondiscrimination Act, which would punish doctors with up to five years in prison for performing abortions because the parents seek a child of the other sex. Despite the vote margin, the bill failed because it was considered under rules that require a two-thirds majority for passage. Twenty Democratic lawmakers voted for the bill; seven Republicans voted against it.

The bill’s chief sponsor, Rep. Trent Franks (R-Ariz.), said his legislation would help fight “a war on unborn little girls,” noting that about 200 million abortions around the world can be tied to the practice of “sex-selection abortions,” which are more common in Asian and Eastern European countries than in the United States.

The White House said President Obama opposed the measure because it intrudes on a woman’s right to privacy and would be hazardous for doctors who perform abortions.

Franks called Obama “the abortion president” Thursday. “There has never been a more pro-abortion leader in the White House in the history of the United States,” he said.

Opponents of the measure criticized Republicans for bringing it up under “suspension rules” and said the measure was another attempt to restrict abortions and force women to justify their reasons for wanting the procedure.

“This is part of an agenda that is clearly not in touch with where the country thinks the House should be focused,” said Ted Miller, communications director for NARAL Pro-Choice America. “It’s completely out of touch with the country’s values and priorities.”

Fifty-four percent of Americans think abortion should be legal in all or most cases, and 43 percent think it should be illegal, according to a Washington Post-ABC News poll from March. A majority of Americans have said abortion should be mostly or always legal in Post-ABC polls since 2003.

The issue of abortion ranks far below top voter concerns this year. In a Washington Post-ABC News poll released last month, 52 percent of voters said the economy is their chief concern; just 1 percent named abortion. Even among white evangelical Protestants — one of the groups most strongly favoring abortion restrictions — just 3 percent picked abortion as their top issue of concern.

Before Thursday’s vote, Franks conceded in an interview that the measure probably would fail but said, “I think we’re doing the right thing strategically” by forcing Democrats to vote against it.

“There are other strategies that can go with this. It’s not a naive strategy,” Franks said, adding that he wouldn’t be surprised if his GOP colleagues and conservative groups use the results of Thursday’s vote to attack vulnerable Democratic opponents.

The antiabortion measure is part of a broader summer-long strategy launched this week by House Republicans to hold votes on legislation with little chance of consideration in the Democratic-controlled Senate that should regardless generate support among conservative and independent voters. Most of the bills are tied to Republican attempts to boost job creation or to repealing portions of the 2010 health-care reform law.

Several nations, including Canada, those of the United Kingdom, Germany and France, ban sex-selection abortions. The United States has no such law, even though the State Department has published reports critical of other countries, including China, for widely accepting the procedure.

Sex-selection abortions are so common in some Asian and Eastern European countries, including China, India, Armenia and Serbia, that the number of boys being born is much higher than the number of girls, according to the Guttmacher Institute, an abortion rights research institute. In the United States, 105 boys are born for every 100 girls, a ratio that the Centers for Disease Control and Prevention considers stable. But limited studies have found the practice is common among Asian American communities, where women cite family pressure to have male children.

Efforts to combat sex-selection abortions are more active at the state level. Eight states have introduced measures this year to ban the procedure, and three states — Arizona, Pennsylvania and Oklahoma — ban sex-selection abortions. A similar law in Illinois was scrapped by state courts.

Polling analyst Scott Clement contributed to this report.