WASHINGTON (Reuters) - President Barack Obama would veto a bill passed by both houses of Congress that would allow survivors and families of victims of the Sept. 11 attacks to sue the government of Saudi Arabia for damages, White House spokesman Josh Earnest said on Monday.

"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 all around the world," Earnest told reporters in a daily briefing.

"I do anticipate the president would veto this legislation when it is presented to him," he said.

The House of Representatives passed the bill by voice vote, without objections, on Friday, after the Senate passed it unanimously in May, clearing the way for it to go to the White House for Obama to sign into law or veto.

Congressional aides said the measure appeared to have enough support, two-thirds majorities in both the Senate and House, for lawmakers to override an Obama veto for the first time since he took office in January 2009.

However, such a vote is unlikely to take place soon. Obama is not expected to get the bill until after Congress leaves Washington. The Senate could leave as soon as this week, and the House next, and lawmakers would not be in Washington again until after the Nov. 8 elections.

Under the Constitution, Obama has 10 days to veto the bill before it automatically becomes law. The Constitution also allows a "pocket veto," in which the president can defeat a bill just by holding onto it until Congress is out of session.

(Reporting by Ayesha Rascoe and Timothy Gardner, additional reporting by Patricia Zengerle; Editing by Chizu Nomiyama and Grant McCool)