Donald Trump has argued heatedly in public with Democratic leaders and threatened repeatedly to shut down the government if Congress does not provide the money he says is needed to build a wall at the Mexican border.
The president insisted the military can build it if Democrats will not vote for the funding.
His comments came as he opened a contentious meeting with Democratic Senate and House leaders Chuck Schumer and Nancy Pelosi, with the government looking at a possible partial shutdown on December 21 when funding for some agencies will expire.
Mr Schumer and Ms Pelosi both said legislation to keep the government open and provide additional border security could pass both houses of Congress, but Mr Trump said major wall funding was necessary.
Mr Schumer said: “You say, ‘my way or we’ll shut down the government’.”
Mr Trump responded that border security was necessary and a wall was necessary for border security.
“If we don’t get what we want … I will shut down the government,” he said.
Constantly interrupting, he squabbled with the Democrats over whether wall funding could be approved in the House or Senate without Democratic votes.
“This has spiralled downwards,” Ms Pelosi said.
The president asked whether Republicans had won the Senate in the November election.
“When the president brags he has won North Dakota and Indiana, he’s in real trouble,” retorted Mr Schumer with a smile.
In a series of tweets earlier on Tuesday, Mr Trump said immigration and border patrol agents and thousands of active-duty service members he sent to the border had done a “fantastic” job, but a “great wall” would be “easier and less expensive”.
He said he looked forward to meeting Mr Schumer and Ms Pelosi, but claimed they do not want border security for “strictly political reasons”.
“If the Democrats do not give us the votes to secure our Country, the Military will build the remaining sections of the Wall. They know how important it is!” he tweeted.
Mr Schumer and Ms Pelosi said on Monday that Republicans have the power to keep the government open since they control Congress and the White House.
“Our country cannot afford a Trump shutdown,” they said in a statement, adding that the president “knows full well that his wall proposal does not have the votes to pass the House and Senate and should not be an obstacle to a bipartisan agreement”.
Republican congressional leaders have repeatedly said it is up to Mr Trump to cut a deal with Democrats, an acknowledgment of their inability to produce spending bills with Republican votes alone.
That gave Democrats some momentum heading into the talks, which also could veer into bipartisan bills on criminal justice reform and reauthorising farm programmes.
By far, the biggest unresolved issue is the border wall. Trump wants the next funding package to include at least 5 billion dollars (£4 billion) for it, an idea Democrats have flatly rejected.