WASHINGTON — In a vote illustrating the changing politics around guns, the House on Wednesday passed a bill to expand background checks to all firearms purchases, the first time in 20 years that either chamber in Congress has approved a significant expansion of gun laws.

After weeks consumed by the government shutdown and jousting with President Donald Trump, Democrats used the vote to make one of their first major policy statements as the House majority — showing that they now see tougher gun laws as a central part of their appeal to voters, even in swing districts. The bill passed 240-190, with support from eight Republicans.

The vote also reflects the shift of power on Capitol Hill, with Democrats now in position to push proposals that couldn’t get a hearing under GOP control.

All but two House Democrats supported the measure to expand background checks, including dozens of newly elected lawmakers from competitive suburban districts. Reps. Andy Kim and Jeff Van Drew, of South Jersey, and Conor Lamb, of Western Pennsylvania, represent districts Trump won, yet were among the 232 House cosponsors.

“This is really I would say the most significant gun violence legislation in a generation,” said Max Samis, a spokesperson for Brady, the group that until Tuesday was called the Brady Campaign to Prevent Gun Violence. “We saw people running on this issue coast to coast last year.”

In Pennsylvania and New Jersey, the group endorsed seven House Democrats who flipped seats previously held by Republicans — along with the only two House Republicans in the Philadelphia region to survive last year, Brian Fitzpatrick of Bucks County and Chris Smith of Central New Jersey. Both Republicans voted for the background check bill up Wednesday.

Meanwhile, Democrats representing suburban areas aggressively highlighted their support for tougher gun laws in campaigns last year and since the election.

“There was a change of leadership, and this leadership now listens to what 90 percent of the American public wants, [which] is universal background checks,” said Rep. Donald Norcross (D., N.J.).

Reps. Mary Gay Scanlon of Delaware County and Madeleine Dean of Montgomery County invited gun violence survivors to be their guests at the State of the Union speech this month.

“There’s been a significant change, and I think you saw it in the 2018 election most clearly,” said Robert Spitzer, a political scientist at State University of New York-Cortland who has written five books on gun policy.

The two measures up Wednesday and Thursday, however, appear likely to be blocked by the Republican-controlled Senate.

But advocates for stricter gun laws still view House passage as a major step after two decades of legislative blockades. Many packed the House chamber and broke into applause and tears after the vote. “This was worth a good cry,” Dean said.

The last time either chamber of Congress passed a gun bill was in May 1999, Spitzer said. Weeks after the Columbine school shootings, the Senate approved a bill to require background checks for firearms sales at gun shows. It was blocked in the House.

The closest any major bill has come since was in 2013, when the Senate rejected a background check bill sponsored by Sens. Pat Toomey (R., Pa.) and Joe Manchin (D., W.Va.) in response to the Sandy Hook Elementary School shooting in Newtown, Conn.

That plan got 55 votes, but it needed 60 to advance, in part because of defections by a handful of Democrats from conservative states.

“It wasn’t that long ago that gun safety was considered the third rail of politics, but today you have a new majority in the House of Representatives that was elected because of, not despite, its enthusiasm for stronger gun laws,” said Peter Ambler, executive director of Giffords, the advocacy group founded by former Arizona Rep. Gabrielle Giffords.

He predicted political damage for Republicans if they refuse to act in the Senate.

“With every day that goes by, with 100 Americans shot every day, they’re going to have to answer to the American people," Ambler said.

U.S. Rep. Greg Steube (R., Fla.) pointed out that the shooters at massacres at Marjory Stoneman Douglas High School in Parkland, Fla., and the Pulse nightclub in Orlando, along with other killers, passed background checks.

“This legislation does nothing to make our schools, churches or communities safer,” Steube said on the House floor Wednesday morning. “In fact, it only infringes on the constitutionally guaranteed Second Amendment rights of law-abiding citizens.”

Republicans also scored a victory by winning adoption of an amendment requiring authorities to notify Immigration and Customs Enforcement if a background check discovers someone in the United States illegally trying to buy a gun. Several Democrats, including Kim and Van Drew, voted for that change.

The House-passed bill would expand background checks to private sales, including online or at gun shows. A second measure, scheduled for a Thursday vote, would require gun dealers to wait 20 days — up from three — for a response to a background check request before going ahead with a sale.

After the House action, the spotlight could again fall on Toomey, one of the few Senate Republicans for broader background checks. But gun control groups have largely soured on his previous proposal, and it doesn’t appear to have gained Senate support. Instead, advocates for tougher laws are backing a plan that mirrors the Democratic House proposal.

“I’m not wildly optimistic" that there is a path to Senate passage for his plan, Toomey said Tuesday, though he said he is considering tweaks.

Kim, the South Jersey freshman who flipped a Republican seat in South Jersey, said the activism of the Parkland students changed the climate.

“To me, as the father of two baby boys, that really hit hard,” Kim said. “In the days and weeks after that tragedy, really, people that never got interested in politics before, never engaged on that issue before, starting coming out and talking to me and saying, ‘What can we do?’”