When Congress reauthorized a controversial program last year that allows the government to scoop up the emails and video chats of foreigners abroad with possible connections to terrorism, it included provisions to safeguard the privacy of Americans on the other end of those communications.

But a recently declassified opinion from the special court that oversees intelligence activities suggests that the FBI didn’t take that mandate seriously enough. Congress needs to ensure that the bureau is following the law.

Section 702 of the Foreign Intelligence Surveillance Act allows the government to collect the electronic communications of foreigners living abroad. The program has been described by members of Congress, including former Senate Intelligence Committee Chairwoman Dianne Feinstein, D-Calif., as a valuable counterterrorism tool.

But in today’s electronically interconnected world, monitoring the communications of foreign “targets” inevitably collects some communications involving Americans.

To protect privacy rights, the current version of the law requires that government agencies keep records of how often they “query” (or search) the huge database of intercepted communications for information about “U.S. persons” — citizens and lawful permanent residents. Section 702 also requires that the queries be “conducted in a manner consistent with the 4th Amendment.”

But in an opinion made public last week, Judge James Boasberg of the Foreign Intelligence Surveillance Court determined a year ago that the FBI hadn’t fully adhered to the privacy safeguards.

For example, he cited several instances in which the FBI searched for information about large groups of U.S. persons without satisfying the requirement that the search be “reasonably likely to return foreign-intelligence information or evidence of crime.”

Some of the searches involved using search terms apparently associated with people who worked for the FBI — presumably, an attempt to use foreign-intelligence information for personnel review.

Until checked by the court, the FBI seemed to have taken Congress’ mandates to protect Americans’ privacy as mere suggestions. Congress needs to demand that FBI Director Christopher A. Wray demonstrate that his agents aren’t engaging in fishing expeditions in the sea of intercepted communications involving Americans.

The law may also need to be changed. Although the FBI must obtain a court order to read the contents of some communications turned up in a computer search under Section 702, the very act of searching without probable cause is a violation of privacy — even if the intention is to look for evidence of a crime.

If Section 702 were completely consistent with the Fourth Amendment, investigators would need to obtain a warrant based on probable cause before they even searched for any American’s communications, as Sen. Ron Wyden, D-Ore., has proposed. Congress needs to revisit that idea.