In this Feb. 6, 2019, photo House Appropriations Committee Chair Nita Lowey, D-N.Y., head of the bipartisan group of House and Senate bargainers trying to negotiate a border security compromise in hope of avoiding another government shutdown, walks with reporters to a Democratic Caucus on Capitol Hill in Washington. Congressional bargainers seem close to clinching a border security agreement that would avert a fresh government shutdown, with leaders of both parties voicing optimism and the top GOP negotiator saying he believes President Donald Trump would back the emerging accord. (AP Photo/J. Scott Applewhite)
In this Feb. 6, 2019, photo House Appropriations Committee Chair Nita Lowey, D-N.Y., head of the bipartisan group of House and Senate bargainers trying to negotiate a border security compromise in hope of avoiding another government shutdown, walks with reporters to a Democratic Caucus on Capitol Hill in Washington. Congressional bargainers seem close to clinching a border security agreement that would avert a fresh government shutdown, with leaders of both parties voicing optimism and the top GOP negotiator saying he believes President Donald Trump would back the emerging accord. (AP Photo/J. Scott Applewhite) Credit: J. Scott Applewhite

Congressional bargainers seem close to clinching a border security agreement that would avert a fresh government shutdown, with leaders of both parties voicing optimism and the top GOP negotiator saying he believes President Donald Trump would back the emerging accord.

It could take days to nail down final details and unexpected problems could develop, especially with Trumpโ€™s penchant for head-snapping changes of mind. Even so, participants said a handshake could come any day on a spending package for physical barriers along the Southwest border and other security measures that would end a confrontation that has dominated the opening weeks of divided government.

โ€œThe president was urging me to try to conclude these negotiations and this is the most positive meeting Iโ€™ve had in a long time,โ€ lead GOP bargainer Sen. Richard Shelby of Alabama told reporters after discussing the parameters of the potential pact with Trump in the Oval Office.

โ€œI gathered today that if we work this out in the context that we were talking today, that I thought was reasonable, very reasonable, that he would sign it,โ€ added Shelby.

โ€œHopefully, weโ€™ll get some good news in a short period of time,โ€ said House Speaker Nancy Pelosi, D-Calif.

Congress has until Feb. 15 to approve an agreement before the government runs out of money.

Trump faces an aggressive, Democratic-led House that is ramping up investigations into Russian involvement in his campaign and businesses and trying to get access to his income tax returns. But ending the border security fight would close one chapter thatโ€™s bruised him, including his surrender after a 35-day partial federal shutdown that he started by unsuccessfully demanding taxpayer money to build the border wall.

Trump, whoโ€™d previously called congressional talks a โ€œwaste of time,โ€ was non-committal.

โ€œI certainly hear that they are working on something and both sides are moving along. Weโ€™ll see what happens,โ€ he said. โ€œWe need border security. We have to have it, itโ€™s not an option.โ€

A senior administration official said the White House is โ€œcautiously optimisticโ€ about getting a deal they could support. The official lacked authorization to discuss the matter publicly and spoke only on condition of anonymity.

The agreement seemed sure to produce far less than the $5.7 billion Trump had demanded to build over 200 miles of the wall, a structure he made a paramount plank of his presidential campaign. It seemed likelier to provide closer to the $1.6 billion a bipartisan Senate panel approved for fencing last year.

Rep. Lucille Roybal-Allard, D-Calif., a negotiator, said it was โ€œunrealisticโ€ to think there would be no funding for physical barriers. โ€œLike in anything else, itโ€™s a trade-off,โ€ she said.

Even with a deal, it was possible Trump might try using claims of executive powers to reach for more wall funding, sparking more fights with Congress.

Sen. Lindsay Graham, R-S.C., said an accord could be โ€œa good down paymentโ€ and added, โ€œThere are other ways to do it and I expect the president to go it alone in some fashion.โ€ Acting White House Chief of Staff Mick Mulvaney said on Fox News Channelโ€™s โ€œHannityโ€ on Wednesday, โ€œIf Congress wonโ€™t participate or wonโ€™t go along, weโ€™ll figure out a way to do it with executive authority.โ€

Members of both parties have expressed opposition to Trump bypassing Congress by declaring a national emergency at the border, a move that would be certain to produce lawsuits that could block the money.

It was unclear what verbiage the evolving pact would use to describe the barriers, with Democrats vowing repeatedly to block funding for a โ€œwall.โ€ Also unresolved was Democratsโ€™ demand to reduce the number of beds for detained migrants operated by the federal Immigration and Customs Enforcement agency.

Sen. Roy Blunt, R-Mo., a negotiator, said both sides are showing flexibility.

โ€œThey are not opposed to barriers,โ€ Blunt said about Democrats. โ€œAnd the president, I think, has embraced the idea that there may actually be something better than a concrete wall would have been anyway.โ€

No. 2 House GOP leader Steve Scalise of Louisiana told reporters that โ€œfrom the things that Iโ€™m hearing, this agreement could get a majority of both Republicans and Democrats in the House.โ€

Still, lawmakers have grown accustomed to expecting the unexpected from Trump. Before Christmas, both partiesโ€™ leaders believed heโ€™d support a bipartisan deal that would have prevented the recently ended shutdown, only to reverse himself under criticism from conservative pundits and lawmakers.

โ€œI remember everybody was optimistic the week before Christmas,โ€ said Sen. Chris Murphy, D-Conn. This time, though, โ€œIt sounds like Trump is closer to reality.โ€

โ€œThereโ€™s a small light at the end of the tunnel,โ€ said Sen. Pat Roberts, R-Kan. โ€œWe just hope itโ€™s not a train coming the other way.โ€