Donald Trump has suggested he is open to a compromise border security measure that would avert another US government shutdown as negotiators in Congress appeared to reach an agreement before the funding deadline expires on Friday.

Republicans and Democrats have broadly embraced the proposed legislation, but have cautioned that they will wait to see the final text of the bill, which includes far less funding than Trump initially sought for his wall along the border with Mexico.

“I don’t want to see a shutdown,” Trump told reporters in the Oval Office on Wednesday. “A shutdown would be a terrible thing.”

Trump said he would take a “serious” look at the legislation when it is released later on Wednesday and search for “landmines” that might imperil the measure.

Following weeks of fraught negotiations, a bipartisan group of lawmakers reached a compromise late Wednesday that would be voted on in the US Senate the following day, a senior Democratic aide said.

The agreement would appropriate $1.375bn for new fencing along the border with Mexico, which is far less than the $5.7bn Trump sought for a concrete or steel wall. But the plan includes less overall funding than the deal Trump rejected in December, which passed the Senate before the president announced his opposition and prompted the longest government shutdown in American history.

There is little appetite on Capitol Hill for another government shutdown, just weeks after a standoff over border security shuttered several federal agencies for 35 days and deprived 800,000 government employees of their paychecks. The government runs out of funding at midnight on Friday.

“This agreement is the last train leaving the station away from another dreaded government shutdown,” the Senate minority leader, Chuck Schumer, said on the floor Wednesday.

“No one wants to see a re-run of that movie,” the Democrat continued. “President Trump: sign this bill.”

Lawmakers were unable to resolve several key differences, such as whether to include a provision providing back pay to federal contractors who were affected by the last government shutdown and an extension of the Violence Against Women Act. Both were left out of the current deal, although a Democratic aide noted the Violence Against Women Act would not be impacted by the lapse because the grants underwriting the law were funded.

Republicans had signaled earlier on Wednesday that Trump would not sign legislation that includes back pay for federal contractors, while Democrats expressed concern that extending the 1994 Violence Against Women Act in this bill would undermine a separate effort to expand protections for victims of domestic violence.

The Senate majority leader Mitch McConnell, a Republican, accused Democrats of a “cynical ploy” and advocated for including the extension in the bill. Funding for the Violence Against Women Act lapses on Friday.

“Republicans believe that we should follow standard procedure and extend this important legislation through the end of this fiscal year, which is about seven months,” he said.

Despite the 11-hour obstacles, party leaders remained confident that the agreement would pass and a shutdown would be avoided.

​In a press conference on Wednesday, the House Democratic caucus chairman, Hakeem Jeffries​, predicted that an “overwhelming majority of the House Democratic caucus” would support the measure.

​If the House passes the measure on Thursday, it would then go to the Senate, where party leaders there have expressed optimism that it will pass. Trump has not publicly committed to signing the agreement – but congressional leaders are hopeful and keen to note that he also hasn’t publicly committed to not signing it.

“The president isn’t fully happy, as he said yesterday with everything that’s in the legislation but there are some positive pieces of it,” the White House press secretary, Sarah Sanders, told reporters​. ​“At the end of the day the president is going to build the wall​.​”

Trump​ said on Tuesday that he was “not thrilled” with the agreement ​but he appeared to soften his position on Wednesday, signaling that he was open to the agreement.

Trump said he is still considering declaring a national emergency as an option to bypass Congress on funding for the wall. But the move would likely invite a legal challenge from opponents who say the president does not have the authority to declare a national emergency in this situation.

“I have a lot of options,” he said, referring to how he will finance the wall construction. “We’ve got a lot of funds for a lot of other things. But with a wall they want to be stingy. We have options that most people don’t really understand.”

