Sens. Charles E. Schumer (D-N.Y.), left, and John Cornyn (R-Tex.) speak to reporters after the Senate voted 97 to 1 for the veto override. (Shawn Thew/European Pressphoto Agency)

Congress voted to decisively overturn President Obama’s veto of a controversial 9/11 victims bill Wednesday, the first override of his presidency and a sharp setback for longtime U.S. ally Saudi Arabia.

The bill clears the way for families of the victims of the Sept. 11, 2001, terrorist attacks to file claims against Saudi Arabia for the kingdom’s long-rumored but unproven links to the 9/11 attackers. The Saudi government has consistently rejected those allegations.

The overwhelming vote to override — 97 to 1 in the Senate and 348 to 77 in the House — reflects the extent to which Saudi influence in Washington has waned. And it comes just over a month before an election that makes it nearly impossible politically to oppose legislation long sought by thousands of aggrieved American families.

Many lawmakers who voted for the override acknowledged problems with the legislation that they hoped could be fixed later.

The measure amended the 1976 Foreign Sovereign Immunities Act to allow for lawsuits against foreign nations in federal court if it is determined that they played a role in terrorist attacks that killed Americans on U.S. soil.

President Obama, as well as many international legal experts and former Republican national security officials, have argued in recent weeks that the bill could make Americans more vulnerable to lawsuits for their activities overseas. But a concerted lobbying campaign by the Saudi government and some of its allies, including several major U.S. firms such as General Electric and Dow Chemical, fell flat as lawmakers from both parties said the bill could ensure some measure of accountability for a tragic event.

“Overriding a presidential veto is something we don’t take lightly, but it was important in this case that the families of the victims of 9/11 be allowed to pursue justice, even if that pursuit causes some diplomatic discomforts,” Sen. Charles E. Schumer (D-N.Y.), who co-wrote the bill with Sen. John Cornyn (R-Tex.), said in a statement.

Obama, speaking at a CNN town hall with members of the military in Fort Lee, Va., said he considered the override “a mistake” but added: “I understand why it happened. All of us still carry the scars and trauma of 9/11.”

“I wish Congress here had done what’s hard,” he said. “My job as commander in chief is to make sure we are looking ahead at how this will impact our overall mission.”

The earliest version of the bill was introduced in 2009, but it only gathered real momentum this spring. On Tuesday, Senate Foreign Relations Committee Chairman Bob Corker (R-Tenn.) said lawmakers did not delve into the details as much as they could have when considering its passage.

“I wish we had all focused on this a little bit more, earlier, but I think the same difficulties would have presented themselves,” he said.

Speaking from the Senate floor Sept. 28, Sen. Bob Corker (R-Tenn.) expressed concerns about a vote to override President Obama's veto of a bill allowing Saudi Arabia to be sued for the Sept. 11, 2001 attacks. (C-SPAN)

Traveling aboard Air Force One on Wednesday, White House press secretary Josh Earnest called the vote “embarrassing” given the cursory review.

“Ultimately, these senators are going to have to answer their own conscience and their constituents as they account for their actions today,” Earnest said.

Obama’s Democratic allies on Capitol Hill provided scant support for the president’s position, with Senate Minority Leader Harry M. Reid (D-Nev.) casting the lone vote to sustain the veto after receiving a letter from the president warning that the consequences of an override could be “devastating.”

One provision in the new bill allows the U.S. government to effectively halt litigation if the State Department certifies there are “good faith negotiations” underway with the defendant nation. That would lead to a 180-day pause, which could be repeatedly extended.

The Saudi government has denied any connection to the terrorists who carried out the 9/11 attacks and has lobbied fiercely against the bill. Victims’ families have long pushed for the legislation so that they can press their case against Saudi Arabia in courts, but many lawmakers who supported the measure said the override vote should not be interpreted as an assertion that Congress thinks the kingdom bears responsibility for the 9/11 attacks.

The rebuke was also another sign of Saudi Arabia’s changing fortunes on Capitol Hill.

Last week, the Senate voted on a resolution to restrict arms sales to Saudi Arabia until it stops targeting civilians in Yemen. It was tabled on a 71-to-27 vote, but Human Rights Watch Washington deputy director John Sifton said it was still “a spectacular statement of concern about Saudi conduct” in Yemen as well as at home, where restrictions are placed on women and political dissidents. “The tide is turning,” he said.

F. Gregory Gause, who heads the international affairs department at Texas A&M University’s Bush School of Government and Public Service, said distrust on both sides has complicated the American relationship with Saudi Arabia.

“This is not a time when U.S.-Saudi relations have much popular support on either side,” he said. Americans, he said, are concerned about the Saudi support for Wahhabism, a conservative strain of Islam that some terrorists embrace. “But the idea that if the Saudis cease to be the Saudis, or if the Saudis became liberal, all this would go away is unrealistic.”

Some senators expressed misgivings about the bill even as they voted for it: 28 of them have signed a letter saying they are open to passing legislation to narrow the scope of the bill in a lame-duck session after the November election.

“I’m for the 9/11 families having their day in court, but I’m also for not exposing our people unnecessarily,” said Sen. Lindsey O. Graham (R-S.C.). Graham said that he respects colleagues who pushed the bill but warned: “If you want to go forward in the Mideast without Saudi Arabia as an ally, then be careful what you wish for.”

Jon Alterman, director of the Middle East program at the Center for Strategic and International Studies, said the bill could be detrimental to U.S. interests. “The biggest issue is that it opens up government agencies to court-ordered discovery,” he said. One example, he offered, was lawsuits filed against the federal government by victims of drone strikes and other American military activities. “It’s not limited to Saudi Arabia, and it’s likely to have a much larger impact on the U.S. government than the Saudi government, because the U.S. government takes rules very seriously.”

International law experts predicted the Saudis could start moving assets out of the United States for fear that they could get frozen in the future by court order.

John B. Bellinger III, who served as the State Department’s legal adviser from 2005 to 2009 and is now a partner at Arnold and Porter, said measures in other countries “are hardly likely to be as precise and surgical as our Congress has been.”

“I do think Congress is playing with fire here, even if for a laudable purpose, just because of the unintended consequences,” Bellinger said, noting he had worked with 9/11 families and was in the White House the day of the attacks. “When we ourselves begin to chip away at sovereign immunity . . . it does encourage other countries to chip away at sovereign immunity.”