WASHINGTON — The White House said on Monday that President Obama would veto legislation approved by Congress that would allow the families of victims of the Sept. 11, 2001, attacks to sue Saudi Arabia for any role in the plot, escalating a bipartisan dispute with lawmakers over the measure.

Josh Earnest, the White House press secretary, said Mr. Obama “does intend to veto this legislation,” and would work to persuade lawmakers in both parties to change course. If he cannot, the measure could lead to the first veto override of his presidency, as the legislation drew the backing of lopsided majorities in both the House and Senate.

“The president feels quite strongly about this,” Mr. Earnest said of the legislation, which Mr. Obama has said could dangerously undermine the United States’ interests globally, opening the country to a raft of lawsuits by private citizens overseas.

“The concept of sovereign immunity is one that protects the United States as much as any other country in the world,” Mr. Earnest said, referring to the rationale behind a 1976 law that gives other countries broad immunity from American lawsuits. “It’s not hard to imagine other countries using this law as an excuse to haul U.S. diplomats or U.S. service members, or even U.S. companies, into courts around the world.”