By Richard Cowan and Steve Holland
WASHINGTON (Reuters) - U.S. lawmakers late on Wednesday completed writing a border security bill that was expected to deny President Donald Trump's request for $5.7 billion to help build a wall on the U.S.-Mexico border, with the Senate and House of Representatives expected to vote on the bill Thursday.
A House Democratic aide said the final draft of the legislation was circulating among a group of 17 negotiators and was expected to be made public soon.
The aide added that the Senate would first vote on the bill sometime on Thursday. If it passes there, the House would then vote on final approval that evening, which would clear it for signing into law by Trump by a Friday deadline.
Without the legislation, about one-quarter of federal government agencies would be forced into a partial shutdown for lack of operating funds.
Trump has not yet said that he would embrace the measure but on Wednesday appeared to be edging toward backing the deal once he saw final details.
Trump, widely blamed for a five-week shutdown that ended in January, said he did not want to see federal agencies close again because of fighting over funds for the wall, one of his signature campaign promises in the 2016 election.
The Republican president did not commit himself to backing the government funding agreement struck between Democratic and Republican lawmakers this week. But two sources and a Republican senator close to the White House said he would likely sign off on it.
"I don't want to see a shutdown. A shutdown would be a terrible thing. I think a point was made with the last shutdown," Trump told reporters. "People realized how bad the border is, how unsafe the border is, and I think a lot of good points were made."
Republican Senator Lindsey Graham said Trump was "inclined to take the deal and move on."
Graham told reporters that Trump would then look elsewhere to find more money to build a wall along the U.S. southern border and was "very inclined" to declare a national emergency to secure the funds.
With a Friday night deadline looming before a shutdown, there is little time for the White House and the political parties in Congress to agree on funding.
Funding is due to expire for the Department of Homeland Security, the Justice Department and several other federal agencies.
LESS MONEY
The outline of a congressional agreement reached on Monday falls far short of giving Trump all the money he wants to help build the wall. Instead, congressional sources say, it includes $1.37 billion for new barriers - about the same as last year - along 55 miles (90 km) of the border.
Like Trump, congressional Republicans have little appetite for a repeat of the 35-day partial shutdown in December and January - the longest in U.S. history - which closed about a quarter of federal agencies and left some 800,000 federal workers without pay.
"It's time to get this done," Senate Majority Leader Mitch McConnell said on the Senate floor on Wednesday, in reference to voting on the compromise.
OTHER OPTIONS
A White House spokeswoman, Mercedes Schlapp, told CNN that lawyers were reviewing the administration's options should Congress not provide Trump's demanded money for the wall.
A variety of sources close to the White House said Trump was likely to explore using his executive power to reallocate other federal funds for barrier projects along the southern border. He was weighing the use of an executive order, among other options, the sources told Reuters.
"The president is going to get that money (in the legislation) and he's going to find other ways to come up with the rest and he's going to build the wall," said one Trump adviser. "At the end of the day, the result is going to be the same."
Trump previously threatened to declare a "national emergency" if Congress did not provide money specifically for the wall - a move that would almost certainly draw opposition in Congress and in the courts.
"We think the president would be on very weak legal ground to proceed," said Hoyer, the No. 2 Democrat in the House.
Speaking to sheriffs and police chiefs of major cities, Trump said later on Wednesday he was determined to "fully and completely" secure the U.S. border, including providing more law enforcement, closing legal loopholes and finishing the border wall.
Trump has come in for criticism from the right for wavering on support for the wall, which the administration says will cut illegal immigration and drug smuggling.
"Trump talks a good game on the border wall, but it's increasingly clear he's afraid to fight for it," right-wing commentator Ann Coulter tweeted on Tuesday.
Trump abandoned a planned compromise on funding for the wall in December after similar criticism.