New legislation being considered by Congress would significantly tighten security screening for foreign military students who travel to the United States on exchange programs, according to a copy of that legislation previewed by the Washington Free Beacon.

In the wake of a deadly 2019 terror attack by a Saudi military exchange student stationed at a military installation in Pensacola, Fla., Senators Joni Ernst (R., Iowa) and Rick Scott (R., Fla.) have crafted legislation aimed at ensuring this type of attack never again takes place.

The legislation, dubbed the Secure U.S. Bases Act, would require strenuous background checks for all foreign military students before they are permitted to enter the United States. It also would create a new class of visas for these students that severely limits the activities they can engage in while on U.S. soil, such as possessing a firearm.

During a congressional hearing Wednesday, Pentagon officials admitted that a series of failures in the current vetting process ultimately cleared the Saudi student who engaged in a shooting spree at Naval Air Station Pensacola that killed three Americans and left eight others wounded. In addition to performing incomplete background checks, the Pentagon said it did not have a system in place to detect red flags among foreign students, such as social media postings expressing anti-American sentiment.

The new legislation acknowledges the value of joint military workshops between allies, but places the security of American personnel first and foremost, the lawmakers said. Currently, there are around 5,000 foreign military students from 153 countries stationed at U.S. bases across the country. The Pentagon is currently performing in-depth background checks on many of these individuals.

"Foreign military programs have valuable benefits—providing our partners around the world the opportunity to train and learn from the best here in the U.S.—but the tragic events at Pensacola underscore the unacceptable shortfalls in our security standards and vetting procedures," Ernst said in a statement. "We must do more to protect our military personnel and ensure the security of our facilities. This bill addresses those shortfalls—creating a more thorough vetting and monitoring process that keeps our service members and military bases secure and safe."

In addition to enhanced background checks, the new legislation would establish limited visas for foreign students, a requirement that would prevent them from purchasing firearms and ammunition, as the Saudi national did before the 2019 attack. It also would initiate a review of these military exchange programs to determine if certain programs would be better placed in foreign countries.

"The safety and security of American men and women in uniform is always a priority for me, and it should be a priority of our entire government. The tragic terrorist attack in Pensacola last year revealed an unnecessary risk," Scott in a statement. "This terrorist should never have been allowed in our country, let alone on an American military base with easy access to American military men and women. The Secure U.S. Bases Act will make sure foreign military students training at U.S. bases are thoroughly vetted and monitored, and that our troops are protected and never have to experience a tragedy like this again."

A range of failures by the U.S. government led to the 2019 attack in Pensacola.

"There is insufficient information sharing in place between DoD and the Department of State in that process," Garry Reid, director for defense intelligence at the Pentagon, testified on Wednesday. "We also found that DoD programs meant to detect and mitigate events such as the Pensacola attack did not cover international military students—for instance, our insider threat programs."

The new legislation offered by Ernst and Scott would tighten the standards for acceptance into all programs based in the United States.

Applicants, for instance, would be forced to provide an official endorsement letter from the chief of intelligence of their country, according to the bill.

It also would mandate U.S. authorities review an applicant's social media postings and task the U.S. director of national intelligence with signing off on each foreign student.