WASHINGTON — President Obama nixed a bill Friday that would have allowed the families of 9/11 victims to sue the government of Saudi Arabia, arguing it undermined national security and setting up the possibility Congress may override his veto for the first time of his presidency.

Obama’s move escalates the fight over an emotional issue that has overlapped with the campaign debate over terrorism and the Middle East. The bill had sailed through both chambers of Congress with bipartisan support, clearing the final hurdle just days before the 15th anniversary of the 9/11 attacks that killed nearly 3,000 people.

The president said the bill, which doesn’t refer specifically to Saudi Arabia, could backfire by opening up the U.S. government and its officials to lawsuits by anyone accusing the U.S. of supporting terrorism, rightly or wrongly.

“I have deep sympathy for the families of the victims of the terrorist attacks of Sept. 11, 2001,” Obama wrote to the Senate in a veto message about the bill, known as the Justice Against Sponsors of Terrorism Act. But, he said, “the JASTA would be detrimental to U.S. national interests more broadly.”

Congress is determined to try to overturn the veto, which requires a two-thirds vote in the House and Senate. Previous attempts to overturn Obama’s vetoes have all been unsuccessful.

House Minority Leader Nancy Pelosi, D-Calif., has said an override would pass in the Republican-controlled House. Yet the Senate would be the greater challenge. After furious lobbying to try to peel off supporters, the White House said Friday it was unclear whether enough had defected to avert an override.

With lawmakers eager to return home to campaign, a vote could come early next week. Senate Majority Leader Mitch McConnell’s office said the Senate would vote “as soon as practicable in this work period.”

Sen. Chuck Schumer of New York, the Senate’s No. 3 Democrat and a traditional Obama ally, came out swinging against Obama while predicting lawmakers would reverse it “swiftly and soundly.”

“The families of the victims of 9/11 deserve their day in court, and justice for those families shouldn’t be thrown overboard because of diplomatic concerns,” Schumer said.

A coalition of 9/11 victims’ families, meanwhile, said they were “outraged and dismayed.”