Washington (CNN) President Barack Obama vetoed a bill Friday that would allow family members of 9/11 victims to sue Saudi Arabia, pitting him against Congress and both presidential candidates on an emotionally charged matter.

The White House claimed the legislation could expose US diplomats and servicemen to litigation in other countries. Republican and Democratic leaders in Congress say they'll override Obama's veto next week.

Obama has now issued 12 vetoes. If successful, Congress' override would be the first of Obama's presidency.

Support for the "Justice Against Sponsors of Terrorism Act" ran high among lawmakers, who overwhelmingly passed the bill earlier this year after pressure from victims' groups. The bill would end foreign countries' immunity in the United States from lawsuits, allowing federal civil suits to go forward if the country is determined to have had a hand in a US terror attack.

In his veto message, Obama wrote he had "deep sympathy for the families of the victims of the terrorist attacks of September 11, 2001, who have suffered grievously."

But he maintained the legislation would seriously hurt US national security interests and cause harm to important alliances, saying it "would neither protect Americans from terrorist attacks nor improve the effectiveness of our response to such attacks."

He warned that the law would hurt the effectiveness of the administration's action against terrorism by taking questions of foreign states' involvement in terrorism "out of the hands of national security and foreign policy professionals and placing them in the hands of private litigants and courts."

Obama also said the move would open Americans abroad, especially those serving in the military, to prosecutions by foreign countries, since this would remove the reciprocal agreements that now protect both sides from such lawsuits.

He also pointed to complaints that allied nations have made about the measure. This legislation, he said, "threatens to limit their cooperation on key national security issues, including counterterrorism initiatives, at a crucial time when we are trying to build coalitions, not create divisions."

Demonstrating the difficult political position the White House is in, Democratic presidential nominee Hillary Clinton, Obama's former secretary of state, expressed her support for the legislation Friday.

"Clinton continues to support the efforts by Sen. (Chuck) Schumer and his colleagues in Congress to secure the ability of 9/11 families and other victims of terror to hold accountable those responsible," said Jesse Lehrich, a Clinton spokesman. "She would sign this legislation if it came to her desk."

Following the veto, Republican presidential contender Donald Trump said in a statement the move "is shameful and will go down as one of the low points of his presidency." Trump, too, said he would sign the legislation as president.

Schumer, a New York Democrat who was a lead supporter of the bill, called the veto "a disappointing decision that will be swiftly and soundly overturned in Congress."

Co-sponsor Sen. John Cornyn, R-Texas, said, "I look forward to the opportunity for Congress to override the President's veto, provide these families with the chance to seek the justice they deserve and send a clear message that we will not tolerate those who finance terrorism in the United States."

White House lobbying effort

In recent days, some of the measure's supporters in Congress have expressed misgivings about the legislation, prompting a new effort by the administration to lobby against the bill.

The White House indicated Friday that was still working to sway lawmakers against the bill, saying that some had indicated privately they had doubts about the measure's implications.

"If we're focused on the substantive, long-term impact on our nation's national security, that's what's driving the position, that's what's driving the President's decision to veto this bill -- not because it's politically convenient, it's not; it's political inconvenient," Press Secretary Josh Earnest said Friday. " But when it comes to the stakes and the impact that this could have on our national security, the President is willing to take some political heat in order to try to do the right thing."

The lobbying effort on Capitol Hill against the legislation has involved the administration but also representatives for the Saudi government, which denies any involvement in the 9/11 terror attacks. The alliance puts Obama in the unlikely position of defending the same position as the Kingdom, with which he's had longstanding disputes over counterterrorism strategies and human rights.

It also puts the President at odds with family members of 9/11 victims, who protested outside the White House this week and spoke alongside lawmakers from New York and Connecticut on Capitol Hill. They, along with other proponents of the bill, say the language is written narrowly to prevent the types of repercussions the administration predicts.

"We are outraged and dismayed at the President's veto of JASTA and the unconvincing and unsupportable reasons that he offers as explanation," read a statement from the 9/11 Families and Survivors. "No matter how much the Saudi lobbying and propaganda machine may argue otherwise, JASTA is a narrowly drawn statute that restores longstanding legal principles that have enjoyed bipartisan support for decades."

Veto override plans

Administration officials had been eying a Friday afternoon veto with the hopes of submitting it to lawmakers after Congress adjourned until November's election contests. But prolonged negotiations over a government funding bill and a package to combat Zika virus have delayed the recess, meaning lawmakers are still likely to be in Washington next week to cast an override vote.

"Our assumption is that the veto will be overridden," Senate Majority Leader Mitch McConnell told reporters on Tuesday.

House Speaker Paul Ryan followed suit Wednesday, saying, "I do think the votes are there for the override." But the Wisconsin Republican also voiced his own doubts about the legislation, saying the implications for lawsuits against Americans worried him.

"I worry about legal matters," Ryan said. "I worry about trial lawyers trying to get rich off of this. And I do worry about the precedence. At the same time, these victims do need to have their day in court."

He was one of several prominent lawmakers who have expressed buyers' remorse for the proposed law. A pair of Republican senators, Bob Corker of Tennessee and Lindsey Graham of South Carolina, have pushed for changes to make it more difficult for the families to pursue lawsuits but could also make it harder for the US to be sued for alleged wrongdoing.

Opponents of the bill gained support Wednesday both from the European Union, which issued its opposition in the form of a "demarche" statement to the US Department of State, and from a bipartisan group of former national security officials, who penned an open letter to Obama.

"The harm this legislation will cause the United States will be both dramatic and long-lasting," the letter read, citing arguments over weakening sovereign immunity. Its signatories included veterans of Republican and Democratic administrations, including Stephen Hadley, a national security adviser to President George W. Bush; Michael Mukasey, a US attorney general under Bush; William Cohen, a secretary of defense under President Bill Clinton; and Richard Clarke, a national security aide to Bush and Clinton.

The letter also noted the law, if enacted, "will most certainly undermine our relationship with one of our most important allies, Saudi Arabia, and damage our relationship with the entire Middle East."