HONOLULU (AP) — A federal judge blocked President Donald Trump's revised travel ban hours before it was to take effect, marking the second time courts have thwarted Trump's efforts to freeze immigration by refugees and citizens of some predominantly Muslim nations.

This time, the ruling came from a judge in Hawaii who rejected the government's claims that the travel ban is about national security, not discrimination. U.S. District Judge Derrick Watson also said Hawaii would suffer financially if the executive order constricted the flow of students and tourists to the state, and that Hawaii was likely to succeed on a claim that the ban violates First Amendment protections against religious discrimination.

Watson criticized what he called the "illogic" of the government's arguments and cited "significant and unrebutted evidence of religious animus" behind the travel ban. He also noted that while courts should not examine the "veiled psyche" and "secret motives" of government decision-makers, "the remarkable facts at issue here require no such impermissible inquiry."

"For instance, there is nothing 'veiled' about this press release: 'Donald J. Trump is calling for a total and complete shutdown of Muslims entering the United States,'" Watson wrote, referring to a statement Trump issued as a candidate.

Trump called the ruling an example of "unprecedented judicial overreach" and said his administration would appeal it to the U.S. Supreme Court. He also called his new travel ban a watered-down version of the first one, which he said he wished he could implement.

"We're going to win. We're going to keep our citizens safe," the president said at a rally in Nashville. "The danger is clear. The law is clear. The need for my executive order is clear."

If the administration seeks an emergency stay of Watson's decision at the 9th Circuit, the matter would be heard by different judges from the three who ruled on the case last month. That's because the panel of judges assigned to such cases rotates every month, said court spokesman David Madden.

The 9th Circuit on Wednesday declined to reconsider the 3-0 decision not to reinstate the original ban. In a dissent, five judges said they considered that decision incorrect and wanted it vacated.

"Whatever we, as individuals, may feel about the president or the executive order, the president's decision was well within the powers of the presidency," Judge Jay Bybee wrote for the five.

Watson issued his 43-page ruling less than two hours after hearing Hawaii's request for a temporary restraining order to stop the ban from being put into practice.

The hearing was one of three held Wednesday in federal courts around the country. U.S. District Judge James Robart in Seattle, who blocked the initial travel ban last month, did not immediately rule on a request from an immigrant-rights group to block the revised version. Neither was there a ruling from U.S. District Judge Theodore Chuang in Maryland in a challenge brought by the American Civil Liberties Union and other groups.