President Trump and top congressional Democrats on Friday failed to reach a deal on a spending plan that would end the two-week-old government shutdown — but agreed to keep talking, even though the president warned that the shutdown could continue for years.

”We just completed a lengthy and sometimes contentious conversation with the president. We agreed that we will continue our conversations. But we recognize on the Democratic side that we really cannot resolve this until we open up government,” House Speaker Nancy Pelosi (D-Calif.) said from the Rose Garden.

“We made that very clear to the president. Services are being withheld from the American people and paychecks are being held with help from people who served the needs of the American people and our border security will suffer if we do not resolve this issue,” she continued, stressing Democrats’ support for increased border security — but not for Trump’s long-promised wall.

“We are committed to keeping our border safe. That has always been our principle to honor the oath of office that we take to protect and defend our country and our Constitution. We can do that best when government is open.”

Trump was expected to address the media later Friday.

Trump, said Senate Minority Leader Chuck Schumer (D-NY), was in no mood to compromise.

“We told the president we needed the government open. He resisted. In fact, he said he would keep it closed for a very long period of time, months or even years,” Schumer said.

Schumer and Pelosi trekked to the White House for the second time this week to try to break the impasse over funding for Trump’s border wall, which he pledged on the campaign trail that Mexico would pay for.

But now the president is demanding more than $5 billion from taxpayers for the wall, while Democrats have offered no more than $1.3 billion for beefed-up border security but not for a wall.

Schumer zinged the president on Twitter prior to the meeting.

“Heading to the White House to hear @realDonaldTrump explain why he wants to keep the government shut down until American taxpayers pay for the wall instead of Mexico,” he wrote, adding a video montage of Trump vowing that Mexico would pay.

Meanwhile, hundreds of thousands of federal workers face missed paydays, and national parks are turning into trash heaps as the two sides dig in.

Democrats on Thursday passed bills to reopen nine federal departments. Eight would be funded through Sept. 30, while Homeland Security would be funded until Feb. 8 so the two sides would have time to cut a deal.

Senate Majority Leader Mitch McConnell (R-Ky.) has said he won’t bring a bill to the floor for a vote unless Trump agreed to sign it — even though the Senate had earlier passed bills identical to those passed by the House.

Pelosi said she wouldn’t budge on her refusal to fund the wall.

“We’re not doing a wall. Does anybody have any doubt about that? We’re not doing a wall,” Pelosi told reporters before the votes to reopen the government.

The meeting Friday follows a border security briefing Wednesday that ended when neither side blinked.

When Pelosi and Schumer had a televised Oval Office sitdown with Trump last month, the president angrily vowed to shut down the government, saying he would be “proud” to own the decision and would not blame Democrats.

Since then, he’s done that repeatedly, calling it the “Schumer Shutdown.”