President Trump said Wednesday that members of both parties were "happy" after they agreed to a deal to allow continued government spending and borrowing for another three months.

"We walked out, and everybody was happy," Trump said before speaking in North Dakota about his tax reform push.

"Not too happy, because you can never be too happy, but they were happy enough, and it was nice to see that happen for a change, as that hasn't happened for a long time in this country," he said.

Republicans were reportedly surprised and even angered by Trump's decision to accept the Democratic position that the government's spending and borrowing authority should only be extended three months. Just before Trump backed that answer, House Speaker Paul Ryan, R-Wis., said such a short-term deal would be "ridiculous," and was pushing for a longer-term deal.

But Republicans were in a bind, as the government needs to find a way to spend another $8 billion in the coming days on Hurricane Harvey recovery, and it can no longer borrow any money.

Democrats said they would only agree to a three-month extension, and many Republicans seemed to acknowledge that might have to be the outcome given the need to provide immediate aid to Texas and Louisiana.

Senate Majority Leader Mitch McConnell, R-Ky., confirmed to reporters that Trump and Democrats agreed to the deal, which Republicans had no choice but to accept.