WASHINGTON — A provision of the government funding bill that passed the Senate on Monday could give Republican senators a big payday over the government allegedly spying on them.

The legislation, expected to become law this week and end the longest government shutdown in U.S. history, looks like it would allow the aggrieved senators to sue the government for at least $500,000 in statutory damages.

The FBI sought phone records from eight Republican senators in 2023 as part of its investigation into Donald Trump’s efforts to subvert the certification of his 2020 loss to Joe Biden, according to documents obtained by Sen. Chuck Grassley (R-Iowa), who said the government “spied” on the lawmakers.

The provision, part of a broader bill that will reopen the government and fund most agency operations into January, would require Senate offices to be notified if federal law enforcement seeks phone records from an official Senate office. Failure to notify would give senators a chance to sue.

“Any Senator whose Senate data, or the Senate data of whose Senate office, has been acquired, subpoenaed, searched, accessed, or disclosed in violation of this section may bring a civil action against the United States if the violation was committed by an officer, employee, or agent of the United States or of any Federal department or agency,” the bill text says.