Rep. Trey Gowdy, R-S.C., all but endorsed President Trump's view that the judiciary is politicized on Sunday.

Last week Trump engaged in a public back-and-forth with Supreme Court Chief Justice John Roberts, who rebuked the president's assertion that an "Obama judge" ruled against his border policy. “We do not have Obama judges or Trump judges, Bush judges or Clinton judges,” Roberts said in an extraordinary statement.

Gowdy, a former federal prosecutor, said he wished he could agree with Roberts.

"I wish Chief Justice Roberts were right. I wish there were not a politicization of the judiciary. But it's not just politicians," Gowdy said Sunday on CBS's "Face the Nation."

"Every print article that you will go find this afternoon refers to judges based on the president that put him or her in office," he added. "And you see terms like conservative and ultra conservative and liberal and moderate, which are political terms but they're used to describe judges. So I wish Chief Justice Roberts were right. I wish that we did not refer to judges based on which president put them in office as if that is somehow going to inextricably lead us to the conclusion. But it's been happening since I was a kid. It's been happening for 50 years that we have used political terms to describe judges."

Gowdy, who is retiring at the end of his term, said he wished the cycle would stop and pinned some of the onus on the media for how outlets portray judges.

"I wish we would stop. But President Trump is not the first person to do it. I think President Obama criticized the Supreme Court to their face in the State of the Union. So I wish everyone would stop, including the media, referring to judges based on which president put them in office," he said.

Trump so far has had the final word in his spat with Roberts.

"Justice Roberts can say what he wants, but the 9th Circuit is a complete & total disaster," Trump tweeted early Thursday morning, on Thanksgiving. "It is out of control, has a horrible reputation, is overturned more than any Circuit in the Country, 79%, & is used to get an almost guaranteed result."

"Judges must not Legislate Security and Safety at the Border, or anywhere else," he continued. "They know nothing about it and are making our Country unsafe. Our great Law Enforcement professionals MUST BE ALLOWED TO DO THEIR JOB! If not there will be only bedlam, chaos, injury and death. We want the Constitution as written!"