Democrats and Republicans have reached an agreement in principle over border security to fund the US government and avert another partial shutdown.
The agreement contains only a fraction of the money President Donald Trump wants for his promised border wall and does not mention a concrete barrier.
The deal still needs to be approved by Congress and signed by the president.
Speaking on Tuesday, Mr Trump said of the deal: "I can't say I'm happy, I can't say I'm thrilled."
He told reporters he would have a meeting about the agreement later on Tuesday.
The Democrats - who now control the House of Representatives - have refused to approve the $5.7bn (£4.4bn) for Mr Trump's wall on the border with Mexico, one of his key campaign pledges.
Lawmakers expressed optimism that a bill would be approved by Friday when funding runs out for some federal agencies.
The previous shutdown - the longest in US history - lasted 35 days and cost the country's economy an estimated $11bn (£8.5bn).
What is known about the deal?
Details have yet to be released but aides familiar with the negotiations say it includes $1.375bn in funding for 55 miles (88km) of new fencing at the border, a small part of the more than 2,000 miles promised by the president.
The barrier would be built in the Rio Grande Valley, in Texas, using existing designs, such as metal slats, instead of the concrete wall that Mr Trump had demanded.
There was also an agreement to reduce the number of beds in detention centres to 40,250 from the current 49,057, reports say.
The talks had reached an impasse earlier with Republicans strongly rejecting Democrats' demands for a limit to the number of undocumented migrants already in the US who could be detained by immigration authorities.
The deal was struck in a closed-door meeting in Washington on Monday evening after several hours of talks.
"We got an agreement on all of it," Republican Senator Richard Shelby said.
"Our staffs are going to be working feverishly to put all the particulars together. We believe that if this becomes law, it'll keep open the government."
But, by Monday night, some of the president's conservative allies had already denounced the deal, with Fox News commentator Sean Hannity calling it a "garbage compromise".
House Freedom Caucus leader Representative Mark Meadows of North Carolina said the agreement failed "to address the critical priorities outlined by Border Patrol Chiefs".
This conference agreement is hardly a serious attempt to secure our border or stop the flow of illegal immigration. It kicks the can down the road yet again, failing to address the critical priorities outlined by Border Patrol Chiefs.— Mark Meadows (@RepMarkMeadows) February 12, 2019
Congress is not doing its job.
Speaking on CNN on Tuesday, Democratic Representative Nita Lowey, chair of the House Appropriations Committee and a key negotiator of the deal, said: "This is a compromise. No one got everything they wanted."
She said she was "cautiously optimistic" the deal would pass.
Let the spin begin
If there was one thing Democratic and Republican congressional negotiators could agree on, it's that another government shutdown would be very bad news.
Republicans feared the public would again blame them for the impasse. Democrats were concerned that federal workers, a key constituency, would face further financial strain.
All that was left was to reach a compromise that allowed both sides to claim a bit of victory. They finally did - and the contours of the agreement look a lot like what was on the table last December, before the president, at the behest of his conservative base, instigated the current crisis.
According to reports, there's some new wall money, but no more than had been agreed to last summer. There's also funding for "border security", including better technology and increased screening at ports of entry, which is the real source of most drug smuggling.
Donald Trump may grouse, but since he's already claiming his wall is being built - "finish the wall" is his new slogan - he probably will find a way to tout the deal as a success. Democrats bent during negotiations, but didn't break.
Both sides will lick their wounds and prepare for the next fight.
What did Trump say?
In a crowded stadium with banners saying "Finish the Wall" in El Paso, in Texas on Monday night, Mr Trump told supporters: "Walls work... Walls save lives."
He repeated that a border fence in the city, opposite Ciudad Juárez in Mexico, "made a big difference", even though critics reject his claim as exaggerated and based on misleading data.
"We need the wall, and it has to be built," said Mr Trump, who has previously threatened to declare a national emergency and fund the wall without Congress.
The idea, however, is disliked even by some fellow Republicans, and Democrats are likely to challenge it in the courts.
The president has backed away from calls to make Mexico pay for a concrete wall, a point he repeatedly made during his presidential campaign, and has already acknowledged that the barrier to be built may not be made of concrete.
As the president spoke, Beto O'Rourke, a former Democratic congressman and potential presidential candidate in 2020, held a counter-rally, accusing Mr Trump of stoking false fear about immigrants with "lies".
Why is there the risk of another shutdown?
On 25 January, President Trump agreed to a three-week spending deal to end the shutdown and allow Congress to reach an agreement.
The shutdown was triggered after Democrats denied the president funding for his promised wall on the border with Mexico, and Mr Trump refused to budge.
During the last shutdown, hundreds of thousands of workers were furloughed (put on unpaid leave) in December and January while others in essential services, such as hospital care, air traffic control and law enforcement, worked without pay.