When President Nixon was in his pre-Watergate heyday, he ordered the FBI and the CIA to electronically monitor the private behavior of his domestic political adversaries. Shortly after Nixon resigned, investigators discovered hundreds of reports of break-ins and secret electronic surveillance. None of it was authorized by warrants, and thus all of it was illegal. But it had been conducted pursuant to the president's orders. Nixon's defense was, "When the president does it, that means that it is not illegal."
He made that infamous statement in a TV interview years after he left office, but the attitude espoused was obviously one he embraced while in the White House. He, like his present-day successor, rejected the truism that the 4th Amendment of the Constitution, which prohibits the government from conducting electronic surveillance of anyone without a search warrant issued by a judge based on probable cause of a crime, restrains the president.
In response to the abuses during the Nixon administration, Congress enacted the Foreign Intelligence Surveillance Act, or FISA, in 1978. The law provides that no electronic surveillance may occur by anyone in the government at any time under any circumstances for any reason other than in accordance with law, and no such surveillance may occur within the U.S. of an American other than in accordance with the 4th Amendment.
The 4th Amendment was written in response to the Colonial experience whereby British soldiers wrote their own search warrants, thus literally authorizing themselves to enter the private property of colonists.
The amendment has been uniformly interpreted by the courts to require a warrant by a judge; and judges can only issue search warrants after government agents, under oath, have convinced the judges that it is more likely than not that the things to be seized are evidence of crimes. This standard of proof is called probable cause of crime. It is one of only two instances in which the founders wrote a rule of criminal procedure into the Constitution itself, surely so that no Congress, president or court could tamper with it.