Thousands of anti-abortion protestors rallied on the mall and marched up Constitution Ave. in Washington D.C. on the same day House Republicans passed a watered-down antiabortion bill. (Michael S. Williamson/The Washington Post)

An emboldened group of moderate House Republicans put their leaders on notice this week that they intend to steer a more pragmatic course on social issues — including abortion, same-sex marriage and immigration — as the party tries to position itself for the 2016 presidential election.

About two dozen Republicans, led mostly by a small group of female lawmakers, forced the House leadership to pull an antiabortion bill from consideration and replace it with a less restrictive measure Thursday. The episode exposed a growing concern within the GOP that emphasizing culture-war issues in the new Congress could distract from the party’s broader agenda and upend hopes of retaking the White House.

“Week one, we had a speaker election that didn’t go the way that a lot of us wanted it to,” Rep. Charlie Dent (R-Pa.) said. “Week two, we were debating deporting children, and again, not a conversation a lot of us wanted to have then. And week three, we’re now debating rape and abortion — again, an issue that most of us didn’t campaign on or really wanted to engage on at this time. And I just can’t wait for week four.”

The latest showdown also exposed a GOP leadership struggling to maintain control of a still-fractious party, despite its expanded majority in the House and its newly achieved majority in the Senate. A similar revolt by moderates erupted last week on a spending bill tied to immigration policy.

Thursday’s vote was a setback for the party’s most strident antiabortion voices, and it came as thousands of activists marched in the streets of Washington to mark the anniversary of the Supreme Court decision that legalized abortion nationwide.

In a show of solidarity with marchers, House Republican leaders planned to push through a bill that would ban abortions after 20 weeks of pregnancy. The bill included exemptions for cases involving severe health risks, incest or rape, but a rape victim could claim the exemption only if the attack had been reported to law enforcement.

The GOP critics, all of whom oppose abortion, said the bill went too far and would expose Republicans in swing districts to a barrage of attack ads in 2016 from women’s rights groups and Democrats. They worry that they could be particularly disadvantaged on abortion and other women’s issues if Hillary Rodham Clinton is the Demo­cratic nominee for president.

More robust moderate voices could affect the outcome of other contentious issues. Some of them have warned about the political consequences of a protracted fight over immigration reform. The House is expected to approve an aggressive border-security bill next week despite Democratic opposition.

The bill comes as Democrats and Republicans are fighting over funding for the Department of Homeland Security.

Following President Obama’s decision last year to use executive authority to change immigration policy, Republicans set DHS on a shorter funding timetable, hoping to prepare a legislative response that would stall the president’s initiative.

House Republicans passed a spending bill last week that would repeal Obama’s executive actions. But several moderates voted against the bill, warning that it went too far by revoking temporary legal protections for “dreamers,” young people brought to this country illegally as children, who have served as the emotional centerpiece of the debate.

The bill is not expected to advance in the Senate, where Democrats are threatening a filibuster, which raises the possibility of another deadline-driven partisan fight that could halt the operations of a sprawling federal department.

In recent years, abortion has been a largely unifying issue for the GOP, but on Thursday, the difficulty of balancing antiabortion views with concerns about women’s rights was evident.

Rep. Jackie Walorski (R-Ind.) was one of the women who raised objections to the initial measure. “We have a responsibility,” she said, “as the elected body representing our constituents, to protect the most vulnerable among us and ensure that women facing unwanted pregnancies do not face judgment or condemnation but have positive support structures and access to health care to help them through their pregnancies.”

The House then voted on a bill that would simply ban taxpayer-funded abortions; it passed 242 to 179, with three Democrats voting yes and one Republican voting no.

The retreat on the initial bill was another setback for House Speaker John A. Boehner (R-Ohio) and his leadership team. People familiar with the process said objections were first raised about two weeks ago and boiled over at a closed-door congressional GOP retreat in Hershey, Pa., last weekend. Rep. Renee L. Ellmers (R-N.C.), a critic of the bill, and others expressed concern again at the weekly House GOP meeting Wednesday, according to aides.

In a last-ditch attempt to shore up support, House Majority Whip Steve Scalise (R-La.) met with Ellmers, Walorski and more than a dozen other female lawmakers Wednesday afternoon in his office. After discussing several options through the day, GOP leaders pulled the bill from the floor schedule.

The bill’s lead sponsor, Rep. Trent Franks (R-Ariz.), called the decision to withdraw the bill “one of the most disappointing moments of my life.” But he said leaders had assured him that the bill will be debated and voted on at a later date.

“The good news: We are talking to each other. There’s no acrimony. Nobody’s yelling at each other. In my mind, that’s a really good sign,” he said.

Rep. Lynn Jenkins (R-Kan.), a co-sponsor of the bill, faulted GOP leaders for failing to follow “regular order” and rushing the bill to the floor to mark the anniversary of the Supreme Court’s historic Roe v. Wade decision.

“If you don’t do business and let the process work, you just run into trouble every time,” she said.

Others suggested that Republican leaders should have been more aware of the political effects of such a bill on female voters in swing districts.

Rep. Carlos Curbelo (R-Fla.), a freshman representing a Miami-area district that is a top target for both parties, reiterated his antiabortion position but said the bill “threatened” the rights of rape victims. “I’m certainly not going to ever put myself in a position where I’m telling any woman whether their account of a rape is valid or not,” he said.

Rep. Patrick Meehan (R-Pa.), a former federal prosecutor from the Philadelphia suburbs, agreed. He said he was concerned about making rape victims “come forward and relive the issue through having to further testify. I wanted that to be considered in everybody’s thinking.”

Angry antiabortion activists noted that Ellmers, Walorski and other critics had voted for a similar version of the bill two years ago. But the stricter reporting requirements had been added at the last minute as part of a procedural vote before final passage, according to aides familiar with the process.

Antiabortion groups had been optimistic about the bill’s chances not only because Republicans had supported an identical bill before but also because it was unveiled so early in the new congressional term.

Pulling the bill “is not a deft political maneuver, by any standard,” said Marjorie Dannenfelser, president of the Susan B. Anthony List, a national antiabortion group. The decision “breeds a little bit of discontent,” she added.

“Sometimes, these moments help clarify resolve and where it is missing,” she said. Dannenfelser promised to keep pressure on GOP leaders to act quickly to bring the bill up for a vote. If they fail to do so, she said, it is a “signal of the dissolution” of the discipline displayed by Republicans through the election season.

Polls indicate that Americans are generally supportive of legal abortion but that they back restrictions on the procedure late in pregnancy. A Quinnipiac University poll in November found that 60 percent of American voters favored a ban on abortions after 20 weeks, including 46 percent of Democrats and 59 percent of women.

Abortion opponents saw the bill as an opportunity to consolidate gains as they pursue a strategy that is less about banning the procedure outright and more about dramatically reducing access. In the past four years, states have enacted 231 abortion restrictions, according to the Guttmacher Institute, a think tank that supports abortion rights. The restrictions range from limiting the use of the abortion pill to imposing strict standards on facilities. Many are the subject of legal challenges by abortion rights groups.

As has become the norm in recent years, the March for Life was overwhelmingly young and religious, with busloads of students arriving from across the country to rally on the Mall. But the collapse of support for a bill many marchers want passed didn’t seem to resonate.

“We’ve been doing this so long that I don’t go up and down” with the political fluctuations, said Geri Nagle, a 71-year-old retiree from New Jersey. The politics, she said, “doesn’t affect me much. The crowds here show where people stand.”

Michelle Boorstein, Sandhya Somashekhar, Sean Sullivan and Karen Tumulty contributed to this report.