The intentions behind former New York City Mayor Rudy Giuliani's interactions with Ukrainian officials determine whether President Trump acted legally, according to Judge Andrew Napolitano.

If Giuliani, the president's personal attorney, asked about the Bidens in relation to a potential criminal probe, that would be perfectly legal, Napolitano said Tuesday on "The Story."

"The federal election statute prohibits the solicitation of aid to a campaign from a foreign national or foreign government," he said.

GIULIANI HIRES FORMER WATERGATE PROSECUTOR JON SALE AS PERSONAL ATTORNEY AMID IMPEACHMENT INQUIRY

"So, if the president was asking for information on Joe Biden so that the DOJ could commence a criminal investigation, that would be acceptable," Napolitano added. "If the president was asking for information on Joe Biden so the Trump campaign could use it against him -- thinking he is likely to be the Democratic nominee -- that would be a violation of federal law."

More from Media

In response, host Martha MacCallum asked how observers know what Trump's intent was.

"We don't," the Fox News senior judicial analyst said. "This is the task of [House Intelligence Committee chairman] Adam Schiff or [House Judiciary Committee chairman] Jerrold Nadler... once it gets to the next step."

"They have to intent -- you infer intent from other things the president has done," he added.

CLICK HERE FOR THE ALL-NEW FOXBUSINESS.COM

Napolitano also noted that Giuliani -- an attorney and federal prosecutor prior to becoming mayor of New York -- has hired counsel himself.

On Tuesday, he retained Jon Sale, a former Watergate prosecutor and a law school classmate at New York University.

Giuliani tweeted Monday night: “I have received a subpoena signed only by Democrat Chairs who have prejudged this case. It raises significant issues concerning the legitimacy and constitutional and legal issues including, inter alia, attorney-client and other privileges. It will be given appropriate consideration."