In 2011, the FISA court ruled that an NSA surveillance program was unconstitutional. The court's opinion has now been declassified, and the Washington Post describes the program:
Under the program, the NSA diverted large volumes of international data passing through fiber-optic cables in the United States into a repository where the material could be stored temporarily for processing and for the selection of foreign communications, rather than domestic ones. But in practice the NSA was unable to filter out the communications between Americans.
A month after the FISA court learned of the program in 2011 and ruled it unconstitutional, the NSA revised its collection procedures to segregate the transactions most likely to contain the communications of Americans. In 2012, the agency also purged the domestic communications that it had collected.
More later after I've had a chance to read the opinion itself.