PALM BEACH, Fla. — President Donald Trump used a Thanksgiving Day call to troops deployed overseas to pat himself on the back and air grievances about the courts, trade and migrants heading to the U.S.-Mexico border.

Trump’s call, made from his private Mar-a-Lago club, struck a political tone as he spoke with members of all five branches of the military to wish them happy holidays.

“It’s a disgrace,” Trump said of judges who have blocked his attempts to overhaul U.S. immigration law, as he linked his efforts to secure the border with military missions overseas.

Trump later threatened to close the U.S. border with Mexico for an undisclosed period of time if his administration determines Mexico has lost “control” on its side.

The call was a uniquely Trump blend of boasting, peppered questions and off-the-cuff observations as his comments veered from venting about slights to praising troops — “You really are our heroes,” he said — as club waiters worked to set Thanksgiving dinner tables on the outdoor terrace behind him.

It was yet another show of how Trump has transformed the presidency, erasing the traditional divisions between domestic policy and military matters and efforts to keep the troops clear of politics.

“You probably see over the news what’s happening on our southern border,” Trump told one Air Force brigadier general stationed at Bagram Airfield in Afghanistan, adding: “I don’t have to even ask you. I know what you want to do, you want to make sure that you know who we’re letting in.”

Trump also continued to rail against the 9th U.S. Circuit Court of Appeals, which he said has become “a big thorn in our side.”

“It’s a terrible thing,” he said, when judges “tell you how to protect your border. It’s a disgrace.”

Later, Trump asked a U.S. Coast Guard commander about trade, which he noted was “a very big subject” for him personally.

“We’ve been taken advantage of for many, many years by bad trade deals,” Trump told the commander, who sheepishly replied that, “We don’t see any issues in terms of trade right now.”

Trump was sure to congratulate himself, telling the officers that the country is doing exceptionally well on his watch.

“I hope that you’ll take solace in knowing that all of the American families you hold so close to your heart are all doing well,” he said.

He later told reporters “nobody’s done more for the military than me.”

Asked what he was thankful for this Thanksgiving, Trump cited his “great family,” as well as himself.

“I made a tremendous difference in this country,” he said. “This country is so much stronger now than it was when I took office, and you wouldn’t believe it, and when you see it, we’ve gotten so much stronger people don’t even believe it.”

But Trump warned about the situation on the southern border as he took questions from reporters, pointing to the caravans of Central American migrants that have been making their way toward the U.S. and warning that, “If we find that it gets to a level where we lose control or people are going to start getting hurt, we’re going to close entry into the country for a period of time until we get it under control.”

He said he had the authority to do so by executive order and claimed he’d already used it this week.

“Two days ago, we closed the border. We actually just closed it, said nobody’s coming in because it was just out of control.”

By no means did he seal the border with Mexico.

Officials did shut down one port of entry, San Ysidro, in California, for several hours Monday morning to bolster security because of concerns about a potential influx of migrant caravan members. They closed northbound lanes into the U.S. and reopened most of them before the morning rush.

Trump probably could close the entire southern border by order, at least temporarily, invoking national security powers.

But doing so could cause extraordinary damage to bilateral relations as well as to cross-border commerce between the U.S. and Mexico, its third largest trading partner.

It would not necessarily stop migrants from coming; Trump would have to contend with the same asylum laws already vexing his efforts to harden the border.

Trump would not discount the possibility of a partial government shutdown over lawmakers’ refusal to allocate billions of dollars for his promised border war.

In his question-and-answer session with the news media, Trump said he’d be interviewing candidates for potential openings in his administration — but wouldn’t say for what positions.

“I’m very happy with my Cabinet and the people working for me and for us. They’re absolute stars.” But, he said, “there’s always a lot of change. I’ll probably be changing a couple.”