President Trump has stunned Republican lawmakers with his abrupt decision to strike a deal with Democrats for a short-term increase in the debt ceiling tied to Hurricane Harvey relief money, though Congress nevertheless is moving quickly toward a vote that could come by the end of the week.

The president made the deal during a White House meeting Wednesday with the top congressional leaders of both parties.

House Speaker Paul Ryan, R-Wis., and Senate Majority Leader Mitch McConnell, R-Ky., had wanted a longer-term increase in the debt ceiling that would also cover hurricane relief funding. Instead, Trump sided with House Minority Leader Nancy Pelosi, D-Calif., and Senate Minority Leader Chuck Schumer, D-N.Y., in agreeing to a three-month deal that would both fund the government and raise the debt ceiling through mid-December, attached to Harvey funds.

The deal averts the threat of a shutdown or even default for now, but virtually guarantees a congressional showdown before the end of the year.

WSJ EDITORIAL RIPS TRUMP ON DEAL WITH DEMS

A source told Fox News that Republican leadership was blindsided by what happened.

Fox News is told the meeting had reached a point where the two sides were moving toward an “agree to disagree” position, when Trump jumped in and agreed to the short-term deal.

The source said it appeared Trump grew weary of the back-and-forth and decided to strike an agreement to end it.

A source with knowledge of the president’s thinking told Fox News he wanted to come out of that meeting with the decks cleared so he could get Congress to focus on tax reform – his big legislative agenda item this fall, which he touted during a speech late Wednesday in North Dakota.

The decision, though, came shortly after Ryan publicly denounced Democrats’ call for a short-term deal as “disgraceful” and accused them of playing politics with the Harvey relief money.

Axios reports that Ryan is furious and McConnell is perplexed at the way it played out.

Still, McConnell has publicly committed to backing the plan and moving forward. Overnight, he doubled the Harvey measure by adding $7.4 billion in community development block grant funds to a House-passed $7.9 billion measure providing an emergency replenishment for disaster aid coffers.

During a Capitol Hill press conference Thursday, Ryan acknowledged he wanted a longer-term increase of the debt limit “for the stability of the credit markets.” But the Wisconsin Republican said he understood Trump’s motivation in striking a deal with the Democrats for a shorter-term increase.

“What he was aiming for in that meeting yesterday was a bipartisan moment while the country is facing two horrible hurricanes,” Ryan said.

The House passed the Harvey aid package on Wednesday by an overwhelming vote. A new vote in the Senate could come as early as Thursday. The plan would be to attach the Harvey aid to the spending and debt-ceiling measures, and then send the package back to the House.

This could all happen by Friday, despite some grumbling in the ranks.

Sen. Ben Sasse, R-Neb., issued a brief statement saying only: "The Pelosi-Schumer-Trump deal is bad."

Oklahoma Rep. Tom Cole, though, called Trump's move "in some sense a declaration of independence by the president."

"I was sort of thrilled," Cole told MSNBC's "Morning Joe" program Thursday. “… We don't need to run out of money in a week or 10 days in the middle of a natural disaster."

Cole told MSNBC: "There's all kinds of implications of what he did yesterday, but count me as saying I believe there's more of an upside than a downside."

Fox News’ John Roberts and The Associated Press contributed to this report.