US President Donald Trump’s extended criticism of the judiciary has prompted a rebuke from his nominee for the Supreme Court, who told a senator the president’s comments were “demoralising and disheartening”.

Judge Neil Gorsuch, who was nominated by Trump to the nation’s high court last week, made the comments after Trump accused an appellate court considering his immigration and refugee executive order of being “so political”.

Over the weekend, the president labelled a judge who ruled on his executive order a “so-called judge” and referred to the ruling as “ridiculous”.

Democratic senator Richard Blumenthal, of Connecticut, first relayed Judge Gorsuch’s remarks on Wednesday following a meeting with the judge.

Trump’s own confirmation team for Judge Gorsuch later confirmed he had made those remarks.

But Trump suggested that Blumenthal had misrepresented Judge Gorsuch, tweeting early on Thursday: “Sen. Richard Blumenthal, who never fought in Vietnam when he said for years he had (major lie), now misrepresents what Judge Gorsuch told him?”

Blumenthal has faced criticism in the past for saying he had served in Vietnam.

He served in the marine corps reserves during Vietnam. He apologised in 2010, saying he regretted his misstatements.

Meanwhile, Alabama senator Jeff Sessions has been confirmed as the new US attorney general, despite fierce Democratic opposition over his record on civil rights and immigration.

The Senate’s virtually party-line 52-47 vote ended weeks of divisive battles over Alabama Republican Sessions, an early supporter of Trump and one of the upper house’s most conservative members.

After the vote was announced, Sessions’ Republican colleagues applauded the outcome, as opposed to barely a handful of Democrats. In a post-vote valedictory speech, Sessions alluded to the bitter partisanship and wished for more unity.

“Denigrating people who disagree with us, I think, is not a healthy trend for our body,” he said.