US law that would allow families of victims to sue Saudi government a matter of “great concern”, foreign ministry says.

Saudi Arabia has condemned a recently passed US law allowing the families of the victims of the September 11, 2001 attacks to sue the Saudi government.

The US Congress voted overwhelmingly on Wednesday to override President Barack Obama’s veto of the Justice Against Sponsors of Terrorism Act (JASTA) on relations between states.

JASTA allows attack survivors and relatives of victims to pursue cases against foreign governments in US federal court and to demand compensation if such governments are proved to bear some responsibility for attacks on American soil.

In a statement on Thursday, the Saudi government said the enactment of the law was a matter “of great concern” and called on the US Congress “to avoid the serious unintended consequences that may ensue”, without elaborating on what the consequences might be.

“The erosion of sovereign immunity will have a negative impact on all nations, including the United States,” the Saudi foreign ministry said in the statement, which was carried on state news agency SPA on Thursday.

READ MORE: The truth about the Saudi bill

Fifteen of the 19 men who carried out the 2001 attacks were Saudi nationals, but Saudi Arabia, a major US ally, has long denied any involvement in the attacks that killed nearly 3,000 people.

In opposing the law, Obama said it would harm US interests by undermining the principle of sovereign immunity, opening up the US to private lawsuits over its military missions abroad.

The erosion of sovereign immunity is also a concern among the six-nation Gulf Cooperation Council, of which Saudi Arabia is the most powerful member.

Saudi Arabia’s Gulf allies have lined up beside Riyadh to criticise the law.

Analysts said a successful lawsuit against the Saudi government would be unlikely at best, but speculated that the uncertainty surrounding the legal implications could negatively affect bilateral trade and investment with an ally.

“It will be very difficult for Saudi Arabia to continue in intelligence cooperation when they take such a hostile position,” Jamal Khashoggi, a veteran Saudi journalist and analyst, told AFP news agency.

He said Saudi officials are probably debating whether to act now or “wait until the first suit is filed”.