No one apparently gave him anything like a Miranda warning: Anything he says can and will be used against him in a court of law.

And that’s exactly what’s happening now in the epic court battle over his travel ban, currently blocked by a temporary order set for argument Tuesday before a three-judge panel of the U.S. Court of Appeals for the 9th Circuit.

AD

The states of Washington and Minnesota, which sued to block Trump’s order, are citing the president’s inflammatory rhetoric as evidence that the government’s claims — that it’s not a ban and not aimed at Muslims — are shams.

AD

In court papers, Washington and Minnesota’s attorneys general have pulled out quotes from speeches, news conferences and interviews as evidence that an executive order the administration argues is neutral was really motivated by animus toward Muslims and a “desire to harm a particular group.”

His words, the two states say in their brief, show “that the President acted in bad faith in an effort to target Muslims.” The courts, they say, “have both the right and duty to examine” Trump’s “true motives.”

AD

The states offer a multitude of exhibits, starting with a December 2015 release from the Trump campaign calling for a “total and complete shutdown of Muslims entering the United States until our country’s representatives can figure out what is going on.”

They cite his August speech advocating screening out people “who believe that Sharia law should supplant American law.”

Another exhibit: His Jan. 27 interview with the Christian Broadcasting Network in which he said he wanted to give priority to Christians in Syria.

AD

They even hauled out Rudolph W. Giuliani’s comment on Fox News that Trump wanted a “Muslim ban” and requested he assemble a commission to show him “the right way to do it legally.”

AD

In response, government lawyers are trying to have Trump’s rhetoric treated, so-to-speak, as inadmissible and irrelevant. It is inappropriate and contrary to precedent, they say in their brief, for the court to “‘look behind’ the stated basis for the Order to probe its subjective motivations.” The states, they complain, are asking “the courts to take the extraordinary step of second-guessing a formal national security judgment made by the President himself pursuant to broad grants of statutory authority.”

How the appeals court and ultimately, no doubt, the Supreme Court, respond remains to be seen. Both sides have their precedents to cite on probing presidential motive.

AD

And there are numerous other issues in the case, including the government’s argument that the states do not have standing to sue. If the appeals court and the Supreme Court agree, this particular case could come to an abrupt halt without a decision on whether Trump’s order violates anyone’s rights under the Constitution.

AD

However it comes out, it may or may not sink in with Trump that his words can be used to wreak havoc with his policy agenda.

His remarks could hurt the government’s key argument as it seeks to reinstate the order — that there was a “rational basis” for issuing it — said Jayashri Srikantiah, an immigration law professor at Stanford Law School.

“When there is a record of evidence, as there is here, of the president making discriminatory comments about Muslims, the question is, does that animate the executive order?” Srikantiah told The Washington Post. “If it does, it raises some serious concerns, and it reflects an intentional discrimination.”

AD

“It’s pretty unusual for a president to make those kinds of statements so candidly or publicly,” she continued. “In some ways, this is new territory.”

AD

Trump’s call for a Muslim ban came just days after the deadly terrorist attack in San Bernardino in 2015, in which a Muslim couple shot and killed 14 people and injured 22 others at a holiday party. In December, during an appearance on ABC’s “Good Morning America,” Trump suggested that the proposed ban was “no different” than President Franklin Roosevelt’s internment of hundreds of thousands of Japanese Americans during World War II.

Trump again called for a “ban” after the Pulse nightclub shooting in June, the deadliest mass shooting in U.S. history. He framed the attack as an immigration issue, even though the shooter was a U.S. citizen born in New York to Afghan parents. The ban, Trump said in a speech in New Hampshire, would be lifted “when we as a nation are in a position to properly and perfectly screen” people entering the country.

AD

“We are importing radical Islamic terrorism into the West through a failed immigration system,” he said. “If we want to remain a free and open society, then we have to control our borders.”

AD

The plan seemed to shift later in the summer, when Trump said he intended to suspend immigration from “any nation that has been compromised by terrorism.” When asked in an appearance on “Meet the Press” in July if the change marked a “pull-back on his Muslim ban,” Trump responded that it didn’t, saying it could be viewed instead as an “expansion.”

In a foreign policy speech the following month, Trump proposed an ideological test for new immigrants, saying government should screen out any travelers “who believe that sharia law should supplant American law.” He seemed to temper his remarks as the election drew closer, calling for “extreme vetting” of people entering the country as opposed to an outright ban. But late last month, in an interview with the Christian Broadcasting Network, Trump said he wanted to give priority to Christian refugees over Muslims fleeing conflict in the Middle East.

AD

All this and more have been submitted as exhibits in the case to illustrate that the travel restrictions aren’t what the administration claims in court: A lawful “exercise of the President’s authority over the entry of aliens into the United States and the admission of refugees” that is neutral on nationality or religion, based not on any hostility toward Muslims but on a congressional determination of countries that are hotbeds of terrorism.

AD

It is unknown what advice President Barack Obama gave to President Trump in the traditional letter left in the Oval Office on Inauguration Day. But he could have given Trump a lesson in how words come back to haunt presidents, as that’s exactly what happened to Obama in his own immigration case when it reached the courts.

When Texas and 25 other states successfully sued to temporarily block Obama’s attempt to shield millions of illegal immigrants from deportation in 2015, among their chief arguments was that the president’s executive actions were an overreach, an end-run around the Republican-controlled Congress that had refused to go along with his proposals.

AD

Among their best pieces of evidence were some of Obama’s own words, uttered at a moment of frustration when he was getting heckled for his deportation policy: “… I just took an action to change the law,” he responded.

AD

Both the U.S. District Court in Texas and the U.S. Court of Appeals for the 5th Circuit used those and other words against him when they ruled against Obama.

When the Supreme Court deadlocked in the case, the lower court decisions stood.

It was, as The Post’s Robert Barnes reported in June 2016, “the biggest legal defeat of his administration.”