Republicans Wednesday cheered the congressional override of President Barack Obama's veto of legislation that would allow families of Sept. 11 victims to sue Saudi Arabia over the attacks — with former New York City Mayor Rudy Giuliani congratulating legislators for "righting that terrible wrong."

"President Obama's veto of the Justice Against Sponsors of Terrorism Act was an insult to the families of those we lost on 9/11," Giuliani said in a statement for the Trump campaign. "The failure of Hillary Clinton's running mate Tim Kaine, who was obviously afraid to show up to work today and stand with these Americans, is a disgrace.

"It demonstrates his basic inadequacy as a leader.

"I will never forget that tragic day, nor the thousands who were lost, and neither will Donald Trump," said Giuliani, who governed the city during the attacks. "These family members are wonderful people who have gone through the unimaginable.

"They deserve the opportunity to seek justice and gain closure on this painful chapter in their lives," he said. "Now, they will finally have the chance to do it."

Both the House and Senate voted decisively to reverse Obama's decision to scuttle the legislation, handing him the first override of his presidency.

Democrats in both chambers abandoned President Obama and joined Republicans in large numbers despite warnings from the president and top national security officials that flaws in the bill could put U.S. interests, troops, and intelligence personnel at risk.

The Senate vote was 97-1. The House vote a few hours later was 348-77.

Lawmakers said their priority was the 9/11 victims and their families, not Saudi Arabia. Obama vetoed the legislation last week.

"The Justice Against Sponsors of Terrorism Act is a commonsense piece of legislation that strengthens the United States' position around the world," said Oklahoma Sen. Jim Inhofe, who supported the override. "This legislation gives victims an avenue to justice with the opportunity to hold those involved in a terrorist attack responsible.

Inhofe is a member of the Senate Armed Services Committee.

"With the rapid spread of terrorism around the world, this legislation is necessary and timely in that it punishes foreign sponsors of terrorism, restoring Congress's intent to hold those who target Americans accountable in U.S. courts."

Arizona Rep. Matt Salmon, a member of the House Foreign Affairs Committee, said that the override proved that Congress "answers first to the American people.

"The September 11th attacks were heinous, but adding insult to injury was a law barring American citizens from seeking compensation simply because some of those who assisted the perpetrators were connected with a foreign government.

"Today's bill rightly remedies that and gives these families access to their own courts for their own protection."

Before the Senate vote, Majority Whip John Cornyn of Texas said that the bill sent "a strong message to those who sponsor terrorist attacks on American soil, including foreign governments, will answer to those victims and pay for the death and destruction that they cause."

Cornyn co-sponsored the bill, first introduced in 2009, with Democrat Chuck Schumer of New York.

"If we allow lawsuits against foreign governments for bar fights, contract breaches, drunk driving, then we should allow the victims of a terrorist attack on our soil the opportunity for their day in court as well," Cornyn said.

"How can anyone look at the families in the eye and tell them that they shouldn't have the opportunity to seek justice against a foreign government responsible for the death of their loved one?

"These families should have the right to make their case," he said. "These families should have the freedom to have their day in court, to have a judge hear their case, and to hold accountable those who played a role in their suffering."

The Associated Press contributed to this report.