Washington (CNN) For much of President Donald Trump's first year, lower court judges frustrated his efforts to impose a travel ban on certain Muslim-majority countries, condemning it as discrimination based on nationality or religion and stitching their opinions with his anti-Muslim rhetoric.

Now the Supreme Court appears ready to side with the administration, accepting its arguments that the new ban is vital to national security and a valid exercise of executive power.

Still, the justices left no doubt during a 67-minute hearing on Wednesday they are aware of Trump's incendiary comments against Muslims from the 2016 presidential campaign. Among his campaign promises, as stated on his website: "a total and complete shutdown of Muslims entering the United States until our country's representatives can figure out what is going on."

After he was elected, Trump voiced similar, if not as robust, sentiment and denounced judges who ruled against the travel ban, belittling them on social media and questioning their legitimacy. He referred to US District Court Judge James Robart, of Washington state, as a "so-called judge" and deemed Robart's February 2017 order temporarily blocking the travel ban "ridiculous." Trump also said, "if something happens blame him and court system."

The scathing back-and-forth that marked the earlier rounds of litigation were far from the staid Supreme Court setting on Wednesday. A majority of the justices suggested by their questions that their legal calculation for the revised proclamation (Trump's third) could get beyond his rhetoric.

Read More