Judge Andrew Napolitano said Barack Obama's alleged wiretapping of Trump Tower is technically legal but it would destroy whatever legacy the former president has if true.

The Fox News senior judicial analyst was a guest Tuesday on "Fox & Friends" discussing whether the former administration would face legal trouble if the wiretapping is confirmed.

The judge said Obama had the power to legally order a wiretap, saying it's directly in the FISA statute that "the president of the United States on his own may conduct surveillance or order surveillance of any person in the United States upon the filing of a certification with the attorney general."

However, he said he thinks Obama allegedly listening in on Donald Trump's phone calls and in-person conversations is "immoral, profoundly unconstitutional and utterly wrong."

"The last thing in the world the intelligence community wants is an investigation by the Congress which will expose how truly pervasive spying is," Napolitano said.

The judge said wiretapping should serve the purpose of securing America as a sovereign entity, not used to torment political opponents.

"I think the political earthquake would destroy whatever legacy Barack Obama had," said Napolitano, adding he thinks the Obama administration did in fact wiretap Trump Tower.

Watch the full interview with the judge above, and check out the below links for the latest on the wiretapping scandal.

Levin: Obama Knew About Alleged Trump Wiretaps 'Unless He's Helen Keller'

Hannity on Trump's Wiretapping Claims: What Did Obama Know and When?

Tucker Battles Dem Congressman Over Trump's Wiretapping Accusations

McCain: Trump Should Not Have Made Serious Wiretapping Claims Via Twitter