In this 2016 photo, stadium lights atop tall poles loom above a pedestrian barrier stretching for miles along a section of the border wall between Douglas, Ariz., and Agua Prieta in the Mexican state of Sonora. (Kenneth Madsen/AP)

President Trump lashed out at Congress on Thursday for failing to deliver his long-promised border wall, unleashing a tweet that accused Democrats of “obstructing” border security and demanded that “REPUBLICANS MUST FINALLY GET TOUGH!”

The trouble for Trump is that it’s his own GOP allies — not just his political opponents — who have been standing in the way.

The same Republican lawmakers who rushed through the tax bill Trump wanted, confirmed his first Supreme Court pick and are fighting to defend his second, and have remained largely deferential amid multiple scandals, have taken a far different approach when it comes to one of Trump’s most memorable campaign promises — deeming the wall to be impractical, unrealistic and too costly.

“People can climb over the wall or go under the wall or through the wall. We’ve seen that in different places,” said Sen. John Cornyn (Tex.), the Senate’s No. 2 Republican, explaining why a system of technology, infrastructure and personnel is preferable to a physical wall. “If it’s just unattended without sensors, without technology, without people, then it won’t work.”

Another powerful Republican, the Senate Appropriations Committee chairman, Sen. Richard C. Shelby (Ala.), said he told Trump that funding a 2,000-mile-long wall could jeopardize money for the military and other programs.

“Some things are reachable and some things aren’t,” Shelby said he told Trump. “I’m committed to securing the borders, whatever it takes in this country; it’s something we haven’t done. But I’m also committed to funding the government.”

The GOP’s recalcitrance on the wall underscores the extent to which immigration and border issues continue to roil the party in the two years since Trump swept into office vowing to take a hard-line approach on the issue.

The idea of building a wall along the U.S.-Mexico border remains hugely popular among Trump’s core supporters, with chants of “Build that wall” still ringing out at his rallies, and numerous candidates in this year’s midterms echoing Trump’s rhetoric. In Florida, gubernatorial candidate Ron DeSantis released a campaign ad showing him urging his little son to construct a wall using building blocks.

But the issue is not as clear-cut for many other Republicans. ­Border-state lawmakers face concerns from landowners and businesses that could face disruption from the construction of a massive barrier. Others represent states and districts with large Hispanic electorates that could be turned off by the idea, while others say the idea of a big wall may be a nice applause line but risks funneling precious funds away from more-essential government functions.

Behind all the rationalizing lies a hardening reality: Many congressional Republicans just aren’t that into Trump’s wall.

Now, Republican leaders are more focused on urging Trump to delay a fight for the wall than on fighting for it themselves. Congress is working to pass a short-term spending bill that would avert a government shutdown Oct. 1 and punt a showdown over wall funding into December, after the November midterms.

Republican leaders have been lobbying Trump to stick with their strategy, which would deliver a big increase in Pentagon spending. Trump has speculated publicly that shutting down the government to get more wall money could be good politics, but Republicans fear a shutdown just before the elections would be disastrous.

No one knows what Trump will do, and some White House officials have begun preparing a contingency plan for the partial shutdown that would occur if Trump vetoes the spending bill.

Trump is being told by aides that he will get more wall money after the elections — even though many in the White House are concerned there won’t be the votes, according to a Trump adviser who spoke on the condition of anonymity to talk freely. Trump often asks what the strategy is for getting wall money after the elections.

“I want to know, where is the money for Border Security and the WALL in this ridiculous Spending Bill, and where will it come from after the Midterms? Dems are obstructing Law Enforcement and Border Security,” Trump tweeted on Thursday.

Sen. Jeff Flake (R-Ariz.), a Trump critic who is retiring, said the wall hasn’t gotten done because “we have priorities here.”

“As much as he wants to say I campaigned on this, this was the central pillar of the campaign, always attached to it was Mexico will pay for it. And they’re not, of course,” Flake said. “So now for him to come to Congress and say ‘Pony up,’ Congress says no. We never agreed to this.”

Administration officials acknowledge privately that there is no plan for how additional funding will be achieved after elections that could see Republicans lose seats in Congress or even their majority.

“I don’t know that I see an answer after the midterms in terms of getting money for the wall either,” said Rep. Mark Meadows (R-N.C.), head of the conservative House Freedom Caucus. “Here we are almost two years into an administration, and significant funding has not happened. . . . Most conservative members are serious about it. I’m not so sure about some of the others.”

In the meantime, Trump continues to remind aides about the cheers the wall gets at rallies but has expressed concerns that his supporters are not seeing enough progress. “We have to keep saying the wall is already happening,” the president said recently, according to the Trump adviser.

The president continually tells lawmakers the wall is a national security issue, and asks whether he can use defense money, according to a senior administration official who spoke on the condition of anonymity to talk freely.

At times Trump has demanded $25 billion for the wall, but a deal giving him that much in exchange for deportation protections for immigrants brought illegally to the country as children fell apart earlier this year, with Democrats blaming the White House and the White House blaming Democrats.

Trump’s current ask for the wall is $5 billion for 2019, but Senate Democrats won’t go along with that figure after striking a deal with Republicans to provide $1.6 billion for 2019, which was the original White House request.

Republicans have tried to convince Trump that the lower number is the best they can do for now, and that the issue will have to be worked out after the elections.

But earlier this year Trump blew up at aides over the $1.6 billion, saying it was not enough. Former legislative affairs director Marc Short, House Speaker Paul D. Ryan (R-Wis.) and others explained to him that it was what his own budget team asked for. Trump did not understand why they didn’t get more — and seemed unaware of what was in his own administration request, according to the Trump adviser. The president has griped periodically about the Office of Management and Budget request.

Then, at a meeting with congressional appropriators in June, Trump demanded $5 billion, without a clear justification for the number.

Trump also has pressed Senate Majority Leader Mitch McConnell (R-Ky.) to eliminate or modify the filibuster rule giving Democrats effective veto power over spending bills in the Senate, a second senior administration official said. McConnell has disagreed.

Officials planned a trip to see prototypes to quell Trump’s anger. Homeland Security Secretary Kirstjen Nielsen, White House Chief of Staff John F. Kelly and others give him periodic updates with pictures.

“We haven’t given up the fight. But if it keeps us from doing other things that are pretty important, like defending the country, then I think it’s a fight not worth having right now,” said Rep. Tom Cole (R-Okla.), a senior member of the House Appropriations Committee. “Let’s get these critical day-to-day functions of the government done, and the American people will be expressing an opinion in the election. We’ll see where we’re at when we come back.”