The House of Representatives on Tuesday overwhelmingly passed legislation that would bolster the security of the U.S. visa waiver program, which allows citizens of 38 friendly countries to enter the U.S. without obtaining a visa.

H.R. 158 passed in a 407-19 vote, and would require visitors from the visa waiver countries, which include much of western Europe, to obtain a visa to travel to the U.S. if they visited Syria, Iraq, Iran or Sudan within the past five years, reported CNN.

The GOP measure, which is supported by top House Democrats and the White House, would also require visa waiver countries to share information with U.S. authorities about suspected terrorists, according to Reuters. If any of the 38 countries fail to share information with the U.S., the Department of Homeland Security would be required to remove that country from the program, according to CBS News.

Congress focused its attention on the visa-waiver program after the Nov. 13 terror attacks in Paris, committed by Islamic State group operatives, and last week's San Bernardino shooting by a couple that supported the group.

"This legislation will help close gaping security gaps and improve our ability to stop dangerous individuals before they reach our shores," said Republican Rep. Michael McCaul, chairman of the House Homeland Security Committee.

All 38 countries, which include France, Belgium and the United Kingdom, would also be required to issue their citizens new fraud-resistant "e-passports" that contain information such as fingerprints. Countries would be required to submit information about lost or stolen passports to the International Criminal Police Organization, otherwise known as INTERPOL.

The U.S. admits about 20 million people a year under the program, which allows them to stay for up to 90 days.

"We live in a free and open society," said Rep. Candice Miller, R-Mich., the author of the measure. "But you have the enemies of freedom who are using our freedoms against us. We have to think clearly about what we can do to mitigate any vulnerability that we have."

The bill is expected to be included in a trillion-dollar spending bill that Congress must pass in the next few days in order to keep the government open. It will then likely go on to become law by the end of the year, according to The Wall Street Journal.

While the bill received bipartisan support from lawmakers, some civil liberties groups warned that the measure was too broadly written and could unfairly exclude people, reports RT.

"We urge Congress to exercise caution and to avoid passing legislation that would broadly scapegoat groups based on nationality, and would fan the flames of discriminatory exclusion, both here and abroad," the American Civil Liberties Union wrote in a letter to lawmakers.