WASHINGTON — Obscured by the furor over surveillance set off by the investigations into possible Trump campaign coordination with Russia during the election, a major debate over electronic spying that defies the usual partisan factions is quietly taking shape in Congress.

The debate centers on the National Security Agency’s incidental eavesdropping on Americans via its warrantless surveillance program, which spies on foreigners abroad whose communications pass through American phone and internet services. Its legal basis, the FISA Amendments Act, is set to expire at the end of 2017.

A bipartisan coalition of privacy-minded lawmakers has started to circulate draft legislation that would impose new limits on the government’s ability to use incidentally gathered information about Americans who are in contact with foreign targets.

Many of those lawmakers are veterans of a fight two years ago over the U.S.A. Freedom Act, a law that ended an N.S.A. program that gathered Americans’ calling logs in bulk. They won that fight against security hawks because the statute on which the program was based, part of the Patriot Act, was expiring and they were unwilling to extend it without ending the bulk collection.