WASHINGTON — President Donald Trump on Wednesday slammed the courts as being “so political” as an appeals court deliberates his immigration and refugee executive order, part of a relentless pounding of the judiciary branch that prompted a rebuke from his nominee for the Supreme Court.

Speaking to a group of police chiefs, Trump said his immigration order was “done for the security of our nation.” He quoted from the portion of the immigration law that he said gave him the power to enact the ban, calling it “beautifully written” and saying “a bad high school student would understand this.”

“Courts seem to be so political, and it would be so great for our justice system if they would be able to read a statement and do what's right,” he added. “And that has to do with the security of our country, which is so important.”

Trump's comments come as the 9th U.S. Circuit Court of Appeals is weighing the appeal of his executive order on immigration, including a temporary travel ban on people from seven Muslim-majority countries. In a hearing Tuesday, judges on the appeals court challenged the administration's claim that the ban was motivated by terrorism fears but also questioned an attorney's argument that it unconstitutionally targeted Muslims.

Since a lower court judge blocked the order last week, Trump has criticized the decision. He labeled the judge in the case a “so-called judge” and called the ruling “ridiculous.”

Legal experts, Democrats and some Republicans criticized Trump's remarks as jeopardizing the independence of the judiciary and attempting to use political influence to sway the courts.

Trump's nominee for the Supreme Court joined the criticism Wednesday in a meeting with Sen. Richard Blumenthal, D-Conn.

Blumenthal said Judge Neil Gorsuch described the president's comments about the judiciary as “demoralizing and disheartening.” Gorsuch's confirmation team confirmed the judge's comments.

In his speech, Trump sought to link his comments about the court battle over his executive order to the law enforcement community in attendance.

“We have to allow you to do your job,” he said. “And we have to give you the weapons that you need, and this is a weapon that you need and they're trying to take it away from you.”

The president has repeatedly said people are “pouring in” since the ban was put on hold and suggested that blocking the order would be dangerous.

Wednesday morning he tweeted, “Big increase in traffic into our country from certain areas, while our people are far more vulnerable, as we wait for what should be EASY D!”

The administration has not provided any information to support his claims.

Customs and Border Protection, the agency in charge of screening people who arrive at U.S. ports, including airports, has not responded to multiple requests to detail how many visa holders from the seven designated countries have been allowed into the United States since a federal judge temporarily blocked the government from implementing the travel ban.

The State Department previously said fewer than 60,000 visas were provisionally revoked after the order was signed and those people would now be allowed to travel to the U.S. Trump's order banned travel to the U.S. for people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen. It also suspended the country's global refugee program.

As of Wednesday afternoon 641 refugees from 13 countries, including five whose citizens were barred from the U.S. under the travel ban, had arrived since a federal judge in Seattle ruled against the government.

White House press secretary Sean Spicer said the president is expressing his frustration with the process that he believes should be subject to common sense. “He respects the judiciary,” Spicer said. “It's hard for him and for a lot of people to understand how something so clear in the law can be so misinterpreted.”

He added that Trump, who has a history of punching back against his opponents both political and personal, is also speaking directly to his supporters who are looking for him to aggressively deliver on his campaign promises.

“He likes to talk to his supporters, to be blunt,” Spicer added. “Part of it is that people wonder, who helped elect him, what is he doing to enact his agenda.”

Paul Cassell, a University of Utah law professor who served as a federal district judge from 2002 to 2007, said he believes Trump “stepped over the line” in his criticism of U.S. District Judge James Robart.

“But I would characterize it as a misdemeanor traffic ticket, not a felony,” he said. “Judges have thick-enough skins that they are used to being criticized.

“The president certainly has a right to criticize the court,” Cassell said.

Hundreds of members of the Major Cities Chiefs Association and Major County Sheriffs' Association were in the standing-room crowd. They clapped sparingly when he asked whether they agreed with his views on the immigration ban. His comments about combating drug abuse and the targeting of police officers drew a more unanimous response.

The Washington Post contributed.