WASHINGTON — The federal government on Sunday morning barreled toward its first shutdown in 17 years after the Republican-run House, choosing a hard line, voted to attach a one-year delay of President Obama’s health care law and a repeal of a tax to pay for it to legislation to keep the government running.

The votes, just past midnight, followed an often-angry debate, with members shouting one another down on the House floor. Democrats insisted that Republicans refused to accept their losses in 2012, were putting contempt for the president over the good of the country and would bear responsibility for a shutdown. Republicans said they had the public on their side and were acting to protect Americans from a harmful and unpopular law that had already proved a failure.

The House first voted 248-174 to repeal a tax on medical devices, then voted 231-192 to delay the law’s implementation by a year — just days before the uninsured begin enrolling in the law’s insurance exchanges. The delay included a provision favored by social conservatives that would allow employers and health care providers to opt out of mandatory contraception coverage.

But before the House had even voted, Senator Harry Reid of Nevada, the majority leader, declared the House bill dead. Senate Democrats are planning to table the Republican measures when they convene on Monday, leaving the House just hours to pass a stand-alone spending bill free of any measures that undermine the health care law.