President Donald Trump on Wednesday broke with his party and agreed to back a short-term debt ceiling extension and government funding measure as part of the package to approve relief funding for Hurricane Harvey.

Senate Majority Leader Mitch McConnell later said he would support the package.

Senate Minority Leader Chuck Schumer and House Democratic Leader Nancy Pelosi said that "the president and the congressional leadership agreed" to the proposal following a meeting at the White House. Republican lawmakers in the room opposed Schumer and Pelosi's push to extend the debt limit and fund the government for only three months, but Trump agreed to it.

Talking to reporters on Air Force One on his way to a tax reform speech in North Dakota, Trump said the deal "will be very good."

"We had a very good meeting with Nancy Pelosi and Chuck Schumer. We agreed to a three-month extension on debt ceiling, which they consider to be sacred — very important — always we'll agree on debt ceiling automatically because of the importance of it," he said, according to a White House transcript.

"Also on the [continuing resolution on funding] and also on Harvey, which now we're going to be adding something because of what's going on [with Hurricane Irma] in Florida — but we had a very good meeting. We essentially came to a deal, and I think the deal will be very good," Trump added.

Just hours before, House Speaker Paul Ryan called a three-month debt limit increase proposed by Democrats "ridiculous" and "unworkable." An extension of only three months for the debt ceiling could give Democrats leverage over the majority Republicans.

If Congress can pass a package containing all three measures, it would knock out politically contentious September deadlines to avoid risking default on the federal debt and a government shutdown. But it would set up another showdown in December and puts the GOP in a difficult spot.

"In the meeting, the President and Congressional leadership agreed to pass aid for Harvey, an extension of the debt limit, and a continuing resolution both to December 15, all together. Both sides have every intention of avoiding default in December and look forward to working together on the many issues before us," Schumer and Pelosi said in a statement.