The problem is that while those views might represent a majority of the nation and even a bipartisan majority of the House and Senate, they seem to be a minority sentiment among the Republicans who control Congress as well as the White House. Given that reality, backers of bipartisan compromise, energized by public support on those issues, can press their case and get to the edge of success but still not prevail.

“The views of the Republicans in power are in the minority when it comes to issues like immigration and guns,” said Frank Sharry, the executive director of America’s Voice, an immigrant rights group. “Those of us trying to figure out how to ride the wave of public opinion are up against an intense minority that is the tail wagging the G.O.P. dog.”

Top congressional Republicans and President Trump say they are simply representing their constituents who see gun control as a threat to deeply personal Second Amendment rights and unenforced immigration laws as a threat to American jobs and security. And conservative Republican voters, at least in the past, have been more driven on these issues than Democrats or moderate Republicans.

But while Republican leaders have been able to successfully thwart the bipartisan push behind both gun safety and immigration legislation, loud public demands for action have meant they could not ignore them altogether.

With a special program for young undocumented immigrants at risk of expiring, Senator Mitch McConnell, the Kentucky Republican and majority leader, was forced to allow votes on the immigration proposals that went nowhere last week. Backers of a bipartisan plan that would have given the Dreamers — but not their parents — a path to citizenship in exchange for $25 billion for a wall on the Southern border sought by the president believed they had the 60 votes needed to advance any significant legislation in the Senate.

But their deal came under scathing attack from the administration, which also wanted new curbs on family-based migration opposed by Democrats and some Republicans. Several anticipated Republican votes for the bipartisan deal melted away, and gridlock resulted once again.

“It was all or nothing and they got nothing,” said Mr. Sharry, who noted Mr. Trump sacrificed what had previously been his overriding immigration priority, the wall.