Taking a blow to his outsize ego, US President Donald Trump has agreed to the Democrats' terms to end the debilitating government shutdown temporarily so that they could work on a separate border security plan paving the way for a regular budget.
On Friday, the 35th day of the partial shutdown, Trump announced the deal with the Democrats and the Senate and House immediately passed by a voice vote temporary spending bills that he signed to fund the federal government till February 15.
The legislative measures did not include any funds for the border wall that Trump had made a condition for approving the budget. The Democrat's refusal to include the $5.7 billion that he wanted for border security in the budget led to the standoff that shut down all but essential government services.
Now the 800,000 government employees, who missed their second fortnightly paycheck on Friday, can return to work with back pay and full government operations can resume.
It was a victory for Democrat House Speaker Nancy Pelosi, who won the war of wills against Trump by defiantly holding on to her stand and showing the power of the House of Representatives that her party wrested away from the Republicans in the November midterm elections.
Under the deal, the Republican and Democratic lawmakers are to sit down together in a committee to device a border security plan that Trump would agree on or face another round of shutdown.
"Based on operational guidance from the experts in the field, they will put together a Homeland Security package for me to shortly sign into law," Trump said.
Democrats wanted to separate the budget and border security "and that's what we got", Chuck Schumer, the Democratic Party leader in the Senate, told the media.
Pelosi said: "I do have to say that I am optimistic. I see every challenge or every crisis as an opportunity, as an opportunity to right things for the American people."
Trump obsesses over the wall along the Mexican border to deter smugglers and illegal immigrants because he made it into a highlight of election campaign and wants make it his signature legacy.
The President repeated his threat to declare a State of Emergency and have the border barriers built using the Army Corps of Engineers and using funds diverted from the defence budget if he does not get a "fair deal", or the government could shut down again.
"As everyone knows, I have a very powerful alternative, but I didn't want to use it at this time," Trump said, adding: "Hopefully it will be unnecessary."
While speaking out against the illegal immigration, he reiterated that he was for legal immigration that is needed for the economy with more industries returning to the US for his "America First" programme.
"We want future Americans to come to our country legally and through a system based on merit," he said.
Distancing herself from the radical wing of the Democratic Party that is against immigration controls, Pelosi conceded: "It is very clear that we all understand the importance of securing our borders, and we have some good ideas how to do that."
Now both the Democrats and Trump will have to overcome objections from the vociferous fringes of their bases to find a solution to the border and the broader immigration crisis.
The first signs of Trump wilting came on Wednesday when he agreed to Pelosi's demand to delay the State of the Union Address after having taunted her for several days over her refusal to let him speak to the joint session of Congress on January 29.
In retaliation, he had even refused her the use of a military plane to visit US troops in Afghanistan.
On Thursday, six of his party's senators crossed the floor to vote for a Democrat resolution to end the shutdown - although that another Republican Party resolution also failed to get the required votes to pass.
Polls showed that his shutdown move was backfiring and steadily more Americans were blaming him for it, rather than Democrats.
Having to give in with nothing to show for it is a blow for Trump, who has boasted about his deal-making skills as a businessman - and even written a book, "The Art of the Deal".
Now Trump is recasting the border wall, which had the image in his campaign of a tall concrete structure, into a high-tech barrier that also uses drones, rather than a physical one with only some stretches of a see-through steel fence.
"We do not need 2,000 miles of concrete wall from sea to shining sea... We never did," he said.
If he gets such a package -- that could include more personnel and immigration judges -- rather than the wall, he could pretend he got what he wanted.
His position is weakened both domestically and internationally and this could impact his policies and strategies in a host of ways.
Ultimately, the shutdown proved to be pointless exercise.
"It is a disgrace that hundreds of thousands of American workers and their families had to suffer because of this senseless shutdown," tweeted Kamala Harris, the Indian-American Senator, who has announced that she wants to contest the 2020 presidential election.
(Arul Louis can be reached at email@example.com and followed on Twitter @arulouis)