US President Donald Trump has criticised the court that is deliberating on his immigration and refugee executive order for having motivations he described as "so political".
Speaking to a group of police chiefs and sheriffs, Mr 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 even "a bad high school student would understand this".
The 9th US Circuit Court of Appeals is weighing the appeal of Mr Trump's executive order on immigration, which temporarily suspends the country's refugee programme and bans travel for citizens of seven Muslim-majority countries.
In a hearing on Tuesday, judges on the appeals court challenged the administration's claim that the ban was motivated by terrorism fears, but also questioned a lawyer's argument that it unconstitutionally targeted Muslims.
Mr Trump said he was watching the proceedings on television.
He noted that there had not been a decision yet, but said that "courts seem to be so political".
He added that it "would be so great for our justice system if they could just read a statement and do what's right. And that has to do with the security of our nation, which is so important".
Mr Trump also repeated his promises to reduce violence in Chicago, saying that "no-one in America should be punished" because of their birthplace.
He pledged to provide resources to police departments and promised "zero tolerance" for violence against law enforcement.
Mr Trump also promised to work on combating drug abuse and said there should be resources to deal with a "mental health crisis".
Hundreds of members of the Major Cities Chiefs Association and Major County Sheriff's Association were in the standing room crowd, some in uniform but the majority in plain clothes.
They snapped photos with their phones as the president spoke, but clapped sparingly when he asked whether they were in agreement with his views on the immigration ban.
His comments about combating drug abuse and the targeting of police officers drew a more unanimous response from the crowd.