WASHINGTON — At about the time Wednesday that two shooters under investigation for potentially having terrorist ties were gunning down people at a community center in San Bernardino, House Republicans blocked legislation that would help prevent people on U.S. terrorist watch lists from buying firearms legally.

Republicans blocked the bill again Thursday, without debate, fending off efforts by Democrats to pass the Denying Firearms and Explosives to Dangerous Terrorists Act of 2015, sponsored by Rep. Peter King, R-N.Y., and Sen. Dianne Feinstein, D-Calif., who had introduced the bill in February.

‘Definition of a no-brainer’

In all, the measure was blocked three times in the House: On Tuesday, the day before the shooting, on Wednesday at 2:11 p.m. EST as the massacre was under way, and again Thursday morning.

“Denying firearms and explosives to dangerous terrorists is the definition of a no-brainer,” Feinstein said Thursday. But the Senate defeated the bill on a mostly party line vote, 44-55.

The Government Accountability Office, a nonpartisan agency that investigates issues for Congress, said in a report more than five years ago that from 2004 to 2010, more than 90 percent of the 1,228 individuals on terrorist watch lists who sought to buy guns were allowed to do so.

“I’m more concerned about them, frankly, than Syrian refugees,” Feinstein said.

The Feinstein/King legislation is modeled on a 2007 proposal by the George W. Bush administration to allow the attorney general to deny known or suspected terrorists the right to buy guns and explosives.

The National Rifle Association, the powerful gun lobby allied with Republicans and conservative Democrats, opposes the bill. “The NRA does not want terrorists or dangerous people to have firearms, any suggestion otherwise is offensive and wrong,” spokeswoman Jennifer Baker said in a statement.

The NRA and Republicans argue that there are hundreds of thousands of people on terrorist watch lists and that a blanket ban on sales of guns and explosives to such people would be an overly broad prohibition on gun ownership. Referring to the placement of people on the terrorist watch lists, Sen. John Cornyn, R-Texas, said Feinstein’s bill assumes “that the federal government never makes a mistake ... but we all know better.”

Democrats dismiss the argument. Feinstein said that if someone is on the government’s no-fly list as being “too dangerous to board an airplane, that person is too dangerous to buy firearms.”

The Brady Campaign to Prevent Gun Violence favors the Feinstein/King bill but said the legislation would not close a big loophole that in most states allows anyone to buy a gun online or at a gun show without a background check. Democrats and some Republicans sought to require background checks on such sales after the 2012 shootings at the Sandy Hook Elementary School in Newtown, Conn., which killed 20 children and six adults, but failed. Another attempt to do so Thursday by Sens. Joe Manchin, D-W.Va., and Pat Toomey, R-Pa., also failed.

The Brady campaign points to a 2011 al Qaeda video by Adam Gadahn, known as “ Jihad Joe,” who urged jihadists to take advantage of the fact that “America is absolutely awash with easily obtainable firearms.” As the video panned over retail gun displays, Gadahn said, “You can go down to a gun show at the local convention center and come away with a fully automatic assault rifle without a background check, most likely without having to show an identification card. So what are you waiting for?”

Attempts to block refugees

Democrats initially began pushing the Feinstein/King gun legislation last month in response to Republican efforts to block admissions of Syrian refugees to the United States after the terrorist attacks in Paris. Democrats also pushed Feinstein’s proposal to tighten the visa waiver program, which allows passport holders from 38 countries, many of them in Europe, easy travel to the United States. About 20 million people enter the United States through the program each year.

House Majority Leader Kevin McCarthy of Bakersfield quickly embraced changes to the visa waiver program, appearing on numerous television shows touting the bill and promising a vote as early as next week.

Carolyn Lochhead is The San Francisco Chronicle’s Washington correspondent. E-mail: clochhead@sfchronicle.com Twitter: @carolynlochhead