In his political fight for a border wall, President Trump has enlisted a new group of surrogates to join conservative talk show hosts and Republican allies in making a public case — Border Patrol agents.

On a tour of a patrol station in McAllen, Tex., this week, Trump gathered 15 agents, dressed in uniforms and tactical gear, to stand next to him as he filmed a minute-long video.

“They have done an incredible job,” said Trump, sporting a “Make America Great Again” hat. “But we all want to see a wall or a barrier because that will make your job even easier . . . Everybody knows we need a barrier; we need a wall.”

The agents remained silent, but the visual message was clear: Trump wanted viewers to believe Customs and Border Protection, an agency of 59,000 employees, is firmly behind him in a political skirmish that has resulted in a partial government shutdown.

By Friday afternoon, the clip had received 2.4 million views on Trump’s personal Twitter account and 1.5 million more on his personal Instagram account.

For Trump, the episode offered the latest example of his willingness to stretch the boundaries of using law enforcement agencies for political messaging. Last week, he brought leaders of unions for Border Patrol and Immigration and Customs Enforcement to the White House briefing room to tout the wall.

Trump also has routinely offered praise on Twitter for one of those union officials — Brandon Judd, who is also an active Border Patrol agent — for his appearances on Fox News in support of the president’s immigration policies.

Trump’s predecessors, George W. Bush and Barack Obama, made trips to the border and invited Border Patrol officials to the White House for roundtable discussions on policy.

But in those cases, the officials “were there to brief on what they found and state their professional opinions for what might be helpful” on policy, said Theresa Brown, a career official at the Department of Homeland Security from 2005 to 2011.

“That amped up a level when Trump was running for office and the unions actively endorsed his candidacy,” Brown said. “It was an explicitly political act, and Trump embraced it.”

Trump campaigned on a law-and-order agenda that sought to appeal to police, sheriffs and military troops. He was criticized by Democrats on a visit to U.S. military bases in Iraq and Germany last month when he signed MAGA hats at the request of troops.

In the summer, Trump held an event at the White House to celebrate the “heroes” of Border Patrol and ICE. Dozens of uniformed agents and officers were feted in the East Room.

Some former government officials said criticism of Trump is overblown.

“It doesn’t strike me as unusual or inconsistent with what other presidents have done to tout policy directives,” Julie Myers Wood, who served as a high-ranking DHS official under Bush, said of his interactions with Border Patrol agents. “Whenever a president shows interest in your area, I think it’s a net positive.”

Yet some national security experts warned that Trump is setting a dangerous precedent in his use of law enforcement and national security personnel as political props while also showing no hesi­ta­tion to punish current and former officials who don’t support his agenda.

Trump has stripped the national security clearances of former officials who have criticized him and harangued the “dishonest media” at a photo op with sheriffs and at a visit to the CIA headquarters. He also allegedly pressured former FBI Director James B. Comey over an investigation into his former national security adviser.

“It’s an in­cred­ibly dangerous cycle,” said Rachel Kleinfeld, a national security analyst at the Carnegie Endowment for International Peace. “In countries where democracy breaks down, you have institutions of the state that do not serve the people — they serve political parties’ interests. And when people stop believing that security protects people equally, you have a return to private justice.”

John Sandweg, who served as a high-level DHS official in the Obama administration, disputed Trump’s contention that the Border Patrol is solidly supporting a wall. Sandweg said the agency has long sought technology upgrades and “mobile assets” that can be quickly deployed to shifting hot spots at the border.

DHS’s immigration enforcement divisions have been in the political crosshairs since the Bush administration created the massive federal agency in the wake of the Sept. 11, 2001, terrorist attacks. ICE, and to a slightly lesser extent CBP, have been the target of intense criticism from some Democrats who have accused their leadership of employing draconian tactics to detain and deport immigrants.

Obama responded by enacting guidelines aimed at focusing resources on terrorists, felons and new undocumented immigrants. But ICE chafed under the directives, frustrated that Obama had “tied their hands too much,” said Brown, the former DHS official.

Yet Brown pointed to Trump’s visit to DHS headquarters during his first week in January 2017, where he singled out Judd, the union chief, for praise in front of new Homeland Security Secretary John F. Kelly.

“I found it extremely strange,” said Brown, who works at the Bipartisan Policy Center, a think tank. “Here’s a president praising the union chief in front of management. These are people who have to negotiate; it’s going to be slightly adversarial. But the president is calling on the union above his own.”

During his border tour in Texas, Trump invited Judd to be part of a roundtable policy discussion, praising him as someone he has known “from the beginning” of his presidential campaign.

“Almost before I announced, he was for my ideas and he was for us,” Trump said. “He was for me, and I appreciate it.”

Judd declined a request for comment. There have been signs of division within the agency. This week, a separate union for federal workers sued the Trump administration on behalf of some Border Patrol agents who have not been paid during the shutdown.

That has not fazed Trump, who late Friday posted another version of his video with the border agents on social media.

“We need a wall,” he said in this clip. “We have to take the politics out of it and we have to get down to business.”