(CNN) President Donald Trump bucked his own party Wednesday and sided with Democrats to support a deal that would ensure passage of disaster relief funding as well as raising the debt ceiling and continuing to fund the government into December.

In a rebuke to Republican leaders, Trump backed Democrats' plan to support a deal that would fund Hurricane Harvey aid but only raise the debt ceiling for three months. Those two items would also be tied to a measure to keep the government open through the end of December, setting up a hugely complicated year end crush of must-pass items.

Ignoring the advice of Republican congressional leadership and that of his own treasury secretary, Trump said he wanted a solution and supported the Democratic plan, according to a source briefed on a meeting that Trump held with congressional leaders Wednesday.

Trump told reporters aboard Air Force One on Wednesday that he'd reached an agreement with congressional leaders to raise the debt ceiling, provide disaster relief funding and pass a short-term spending bill.

"We had a very good meeting," Trump said of his conversation earlier in the day with top Democratic and Republican leaders at the White House. "We essentially came to a deal and I think the deal will be very good."

In the meeting with Trump, top Hill Republicans -- including Senate Majority Leader Mitch McConnell and House Majority Leader Kevin McCarthy -- and Treasury Secretary Steven Mnuchin all echoed concerns about the Democrats' demand for a short, three-month debt limit.

Republican leaders, according to the source, pushed for an 18-month debt limit hike, then floated six months. After Pelosi and Schumer dismissed the six-month hike, Trump then agreed to the three-month increase that Democrats put on the table.

Trump's daughter, Ivanka Trump, entered the Oval Office toward the end of the meeting to say hello, the source added. "The meeting careened off topic," the source said. "Republican leaders were visibly annoyed by Ivanka's presence."

House Speaker Paul Ryan earlier called the Democratic leaders' push for a short, three-month increase in the debt limit "a ridiculous idea."

"I think that's ridiculous and disgraceful that they want to play politics with the debt ceiling at this moment when we have fellow citizens in need to respond to these hurricanes so that we do not strand them," Ryan told reporters.

Democratic leaders made their announcement Wednesday morning, saying in a statement they would support a debt ceiling bill being tied to Harvey aid, but only if the measure to avoid default lasted for three months.

"Given Republican difficulty in finding the votes for their plan, we believe this proposal offers a bipartisan path forward to ensure prompt delivery of Harvey aid as well as avoiding a default, while both sides work together to address government funding, Dreamers, and health care," House Minority Leader Nancy Pelosi and Senate Minority Leader Chuck Schumer said in the statement.