President Obama on Friday vetoed a widely supported bill that would allow families of 9/11 victims to sue the government of Saudi Arabia – setting up a showdown with Congress where lawmakers on both sides of the aisle aim to override the president’s decision.

Obama, vetoing the legislation just hours before it was set to become law, cited the potential for the bipartisan bill to backfire against the U.S., its diplomats and military personnel. While saying he has “deep sympathy” for 9/11 victims’ families, Obama said the bill “does not enhance the safety of Americans from terrorist attacks, and undermines core U.S. interests.”

But Congress was expected to move rapidly to try to override the veto, which requires a two-thirds vote in the House and Senate. A successful override would be the first of Obama's presidency.

With lawmakers eager to return home to campaign ahead of the November election, a vote could come as early as Tuesday. Even House Democratic Leader Nancy Pelosi, an Obama ally, indicated support this week for an override, saying members believe the families “should have their day in court.”

Democratic New York Sen. Chuck Schumer called the veto a “disappointing decision that will be swiftly and soundly overturned in Congress.”

Senate Majority Leader Mitch McConnell's office said the Senate would take up the override "as soon as practicable in this work period."

The Justice Against Sponsors of Terrorism Act sailed through both chambers of Congress by voice vote, with final House passage coming just two days before Obama led the nation in marking the 15th anniversary of the attacks that killed nearly 3,000 people in New York, Washington and Pennsylvania on Sept. 11, 2001.

The legislation gives victims' families the right to sue in U.S. court for any role that elements of the Saudi government may have played in the 2001 attacks. Fifteen of the 19 hijackers were Saudi nationals.

Families of the victims spent years lobbying lawmakers for the right to sue the kingdom in U.S. court. Saudi Arabia, a key U.S. ally in the Middle East, strongly objected to the bill.

Obama long had objected, too, warning that if U.S. citizens are allowed to take the Saudis into court, then foreign countries could do the same to the United States, its diplomats and its service members. The administration was also apprehensive about undermining a longstanding yet difficult relationship with Saudi Arabia. The U.S. relies on the Saudis as a counter to Iran's influence in the region as well as to help combat the spread of terrorism throughout the Middle East.

It remains unclear whether the White House has peeled off enough votes to avert a veto override, which would be a major defeat for the president.

The Associated Press contributed to this report.