WASHINGTON — The White House lashed out at Congress on Thursday, a day after Republicans and Democrats overwhelmingly overrode President Barack Obama’s veto of a bill to allow families of the 9/11 victims to sue Saudi Arabia. The White House turned to mockery as top GOP leaders expressed buyer’s remorse and vowed to fix the bill.

House Speaker Paul Ryan, R-Wis., and Senate Majority Leader Mitch McConnell both said the measure, the only law enacted over Obama’s veto in his eight years as president, needed repairs. McConnell said the law may have “unintended ramifications,” while Ryan said “there may be some work to be done” to make sure it doesn’t lead to U.S. service members overseas being sued.

“Everybody was aware of who the potential beneficiaries were but nobody really had focused on the downside in terms of our international relationships,” McConnell told reporters at a Capitol Hill news conference.

The law gives victims’ families the right to sue in U.S. court for any role that elements of the Saudi government may have played in the 2001 attacks. Courts would be permitted to waive a claim of foreign sovereign immunity when an act of terrorism occurred inside U.S. borders.

Supporters said the families of 9/11 victims should be able to pursue justice against Saudi Arabia for its alleged backing of the attackers. Fifteen of the 19 Sept. 11 hijackers were Saudis. Nearly 3,000 people in New York, the Washington, D.C., area, and Pennsylvania died in the terror attacks.

The White House had long raised concerns about the law, warning that it could have a chilling effect on Saudi Arabia’s cooperation with the U.S. in fighting terrorism. Senior national security officials also argued that it could trigger lawsuits from people in other countries seeking redress for injuries or deaths caused by military actions in which the U.S. may have had a role.

But top lawmakers said the White House didn’t press those warnings until it was too late and the popular bill was already barreling its way through Congress. Other lawmakers acknowledged that they didn’t pay much attention to the bill.

That earned McConnell and others a scathing response from the White House, which said lawmakers didn’t know what they were voting for.

“What’s true in elementary school is true in the United States Congress: Ignorance is not an excuse,” said spokesman Josh Earnest.

With enough blame for the White House and Congress to go around, both sides engaged in finger-pointing.

Earnest said the president had publicly discussed the bill’s potential negative impact in April. The Senate passed the bill by voice vote in May. The president, administration officials and other national security experts wrote letters detailing concerns in recent weeks — though many of the letters came after the House backed the bill on Sept. 9.

“I think what we’ve seen in the United States Congress is a pretty classic case of rapid onset buyer’s remorse,” Earnest said.

McConnell, R-Ky., said the White House was too slow to warn about the “potential consequences” of the measure. Both the House and Senate overwhelmingly overrode Obama’s veto of the measure on Wednesday.

McConnell said he told the president recently that the 9/11 victims bill “was an example of an issue that we should have talked about much earlier.”

McConnell said the dynamic involving the bill — in which it picked up unstoppable election-year momentum — was what happens when there is “failure to communicate early about the potential consequences of a piece of legislation that was obviously very popular.”

Other top Republicans and Democrats such as Senate Foreign Relations Committee Chairman Bob Corker, R-Tenn., are already working on proposed fixes to the law.

“We want to make sure that the 9/11 victims and their families have their day in court. At the same time, I would like to think there may be some work to be done to protect our service members overseas from any kind of — any kind of legal ensnarements that could occur, any kind of retribution,” Ryan said.

In a statement, Saudi Arabia’s Ministry of Foreign Affairs said it was their “hope that wisdom will prevail and that Congress will take the necessary steps to correct this legislation in order to avoid the serious unintended consequences that may ensue.”

Associated Press writer Kathleen Hennessey contributed to this report.