Driven by the Paris terror attacks, the House voted overwhelmingly Tuesday to tighten controls on travel to the U.S. and require visas for anyone who's been in Iraq or Syria in the previous five years.

The legislation takes aim at the "visa waiver" program that allows citizens of 38 countries to travel to the U.S. for stays of 90 days and less without first obtaining a visa from an embassy or consulate. Belgium and France, home to most of the perpetrators of last month's Paris attacks, are among the participating countries.

The bill, which passed 407-19, would institute a series of changes, including the new visa requirement for citizens of Iraq, Syria and any other country deemed a terrorist hotspot, along with anyone who's traveled to those countries in the previous five years. Exceptions are made for official government visits and military service.

Countries in the visa waiver program would also be required to share counterterror information with the U.S. or face expulsion from the program. All travelers would be checked against Interpol databases, and visa waiver countries would be required to issue "e-passports" with biometric information.

"You have more than 5,000 individuals that have Western passports in this program that have gone to Iraq or Syria in the last five years," said Majority Leader Kevin McCarthy. "Those are gaps that we need to fix."

Some 20 million visitors come to the U.S. annually under the visa waiver program. They already are screened through an online system maintained by the Department of Homeland Security, and the White House has recently announced a series of improvements to that and other aspects of the program.

But in past years, the program has been used by would-be terrorists, including "shoe bomber" Richard Reid, who boarded a flight from Paris to Miami in December 2001 without a visa and attempted to set off a bomb. Zacarias Moussaoui, the "20th hijacker" from 9/11, also flew from London to Chicago with a French passport and no visa in February 2001, according to a Homeland Security Inspector General report from 2004.

Lawmakers of both parties spoke in favor of the legislation, which is also backed by the White House. It's a rare area of bipartisan agreement after the Obama administration's fury when the House passed legislation last month cracking down on the Syrian refugee program in the immediate aftermath of the Paris attacks.

The Syrian refugee bill, which the administration said was unnecessary because the small number of Syrian refugees are already extensively screened, has not gone anywhere in the Senate and looks unlikely to advance. The visa waivers bill, on the other hand, may be added to a must-pass year-end spending bill now being finalized on Capitol Hill. There is a different version in the Senate by Democrat Dianne Feinstein of California and Republican Jeff Flake of Arizona. The travel industry, which backs the House bill as a balanced approach, says the Senate bill goes too far in adding new biometric requirements for all visa waiver travelers that might be difficult to enact.

Separately, some lawmakers are also talking about looking at the fiancé visa program that allowed Tashfeen Malik, the shooter in the recent attacks in San Bernardino, California, into the country. The Homeland Security Department has already announced a review of that program.

A handful of Democratic lawmakers spoke against the visa waiver legislation before its passage. Rep. Keith Ellison, D-Minn., said the bill is overbroad in stripping visa waiver privileges from all Syrian and Iraqi nationals and said it should include more exceptions for more people, such as journalists and researchers. "Our focus should be on terrorism, not just country or origin," Ellison said.

But most Democrats joined Republicans in enthusiastically embracing the bill. "This is a good bill, it's one that's time has come," said Rep. Bennie Thompson of Mississippi, top Democrat on the House Committee on Homeland Security.