WASHINGTON — President Trump stormed out of a White House meeting with congressional leaders on Wednesday after Speaker Nancy Pelosi said she would not fund a border wall even if he agreed to reopen the government, escalating a confrontation that has shuttered large portions of the government for 19 days and counting.

Stunned Democrats emerged from the meeting in the White House Situation Room declaring that the president had thrown a “temper tantrum” and slammed his hands on the table before leaving with an abrupt “bye-bye.” Republicans disputed the hand slam and blamed Democratic intransigence for prolonging the standoff.

When the meeting was over, talks to reopen the government appeared to be in disarray. The contentious, brief and futile session underscored an impasse that is looking each day like an insurmountable gulf between the two sides. Mr. Trump will visit the border on Thursday in McAllen, Tex., leaving little hope of a resolution for a shutdown that will tie the longest in the nation’s history on Friday.

“It wasn’t even a high-stakes negotiation; it was a petulant president of the United States,” Ms. Pelosi said as she returned to the Capitol. “A person who would say, ‘I’ll keep government shut down for weeks, months or years unless I get my way.’”