The House easily passed legislation Tuesday that would end the visa waiver privilege now offered to western passport holders if they have traveled to Iraq, Iran, Syria or Sudan, which are considered breeding grounds for terrorism.

Lawmakers approved the measure with an overwhelming bipartisan vote, 407 to 19.

The legislation is part of a broader effort by the GOP to shore up national security following the terrorist attacks in Paris and San Bernardino, Calif.

Speaker Paul Ryan, R-Wis., said the bill "will help neutralize the threat of foreign terrorists entering this country," and he added the GOP would be introducing additional legislation addressing that threat.

"We are working together to tackle this threat and we are ready to do more," Ryan said.

While it was written by a group of House GOP lawmakers who chair security-related panels, it garnered broad Democratic support, including the endorsement of top Democratic leaders. But most Democrats are opposed to another GOP bill that would essentially halt President Obama's plan to resettle thousands of Syrian and Iraqi refugees in the United States.

House Minority Leader Steny Hoyer, D-Md., called the modification to the visa waiver program that passed Tuesday "a reasonable and measured step" to deal with the terror threat.

Under the legislation, travelers from the four countries would have to first apply for a visa before entering the United States, which would require a much higher level of scrutiny than simply entering with a passport. Dual passport holders from any of the four countries flagged in the legislation would also have to apply for a visa.