Congress passed the Foreign Intelligence Surveillance Act in 1978.  According to the U.S. Department of Justice website:

"The Foreign Intelligence Surveillance Act of 1978 prescribes procedures for requesting judicial authorization for electronic surveillance and physical search of persons engaged in espionage or international terrorism against the United States..."

The Act was amended in 2001 by the "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism" (USA PATRIOT Act) and further amended in 2002 in the Intelligence Authorization Act and the Homeland Security Act of that year.

Further amendments to FISA came into effect when, on August 5, 2007, President George W. Bush signed the "Protect America Act of 2007". That legislation contained a sunset provision and as Congress did not act to extend or make permanent the "Protect America Act," it expired on February 17, 2008.