The override effort in the North Carolina House failed after a 67-53 vote, just short of the three-fifths majority needed to overturn Mr. Cooper’s veto. The State Senate voted in April to override the governor.

In statehouses across the country this year, a number of other Republican-dominated states have passed anti-abortion measures, including several that would ban the procedure once health care providers were able to detect the pulsing of what would become a fetus’s heart, which can be as early as six weeks into pregnancy. Alabama approved a law last month that would forbid nearly all abortions in the state.

The failure on Wednesday to overturn Mr. Cooper’s veto was among the most dramatic consequences of Democratic legislative victories in North Carolina last November, which broke Republican supermajorities in both chambers and made it easier for Mr. Cooper’s vetos to survive. Those wins were also a subtle but important shift in the balance of power favoring Mr. Cooper, whose November 2016 victory was the first crack in the Republican Party’s near-total control of state politics.

Those who supported Senate Bill 359 said the measure was an important check on potential infanticide. The legislation stated that “if an abortion results in the live birth of an infant, the infant is a legal person” and entitled to protection under North Carolina law. Penalties for not providing care after a failed abortion would have included a fine of up to $250,000 and potential prosecution under the state murder statutes.

The office of House Speaker Tim Moore said in a statement issued Wednesday that the failed override effort was the “final vote” on the matter. Mr. Moore added that Democrats had “successfully prevented a duty of care for all living, breathing North Carolinians born alive in the state.”