shutdown@ (Adds Senate vote due on Friday night and details)
WASHINGTON, Jan 19 (Reuters) - U.S. lawmakers raced the clock to avoid a federal government shutdown before a midnight deadline on Friday after a meeting between President Donald Trump and Senate Democratic leader Chuck Schumer failed to produce a deal.
Trump invited Schumer to the White House for talks as a stopgap bill to fund the federal government through Feb. 16 appeared headed to defeat in the Senate, where Democratic votes are needed to pass it.
Democrats have demanded that the bill include protections for hundreds of thousands of young illegal immigrants, but Republicans have so far refused.
A procedural vote on the bill was set for 10 p.m. (0300 GMT), Senate Majority Leader Mitch McConnell said.
Lawmakers huddled in meetings on Friday evening, but it was not clear if either side would blink before midnight.
Trump said his meeting with Schumer was "excellent" and that efforts were continuing. "Making progress - four week extension would be best," Trump said in a tweet.
Shortly after Trump's tweet, White House budget director Mick Mulvaney said he expected an agreement would be reached in the next 24 hours, indicating the government would shut down at midnight but reopen again at some point over the weekend.
Schumer said his meeting with Trump lasted about 90 minutes. "We discussed all of the major outstanding issues. We made some progress, but we still have a good number of disagreements. The discussions will continue," he told reporters.
The shutdown would begin on the first anniversary of Trump's inauguration as president. Leaders of both parties tried to blame each other for the impasse.
Past government shutdowns have done little lasting damage to the U.S. economy, but put hundreds of thousands of "non-essential" federal workers on temporary unpaid leave. Shutdowns can also rattle financial markets.
"Essential" employees who deal with public safety and national security would keep working under a shutdown.
The Republican-controlled House of Representatives approved the stopgap spending measure late on Thursday, but it has been sidetracked in the Senate by the dispute over immigration.
The House recessed on Friday for a week-long break, but members were warned they could be called back for votes.
The last significant shutdown was in 2013, when government funding lapsed for 16 full days and about 800,000 federal workers were put on temporary leave.
This week's showdown follows a months-long struggle in Congress to agree on government funding levels and the immigration issue.
The federal government is operating on a third temporary funding measure since the current fiscal year began in October.
Democrats have demanded the bill include protections from deportation for about 700,000 illegal immigrants who were brought into the United States as children.
Known as "Dreamers" and largely from Mexico and Central America, these immigrants were given temporary legal status under the Deferred Action for Childhood Arrivals (DACA) program started by former President Barack Obama.
In September, Trump announced he was ending the program and giving Congress until March 5 to come up with a legislative replacement.
"DON'T TURN YOUR BACK"
Dick Durbin, the No. 2 Democrat in the Senate and who has taken a lead role in the immigration issue, said Republicans needed to sit down and negotiate and called on House Republicans not to leave town until the crisis was averted.
"I would beg them, dont turn your back on your responsibility right here in Washington to work with us, to try to find a way forward," Durbin said.
Trump said in a morning tweet that Democrats were holding up a resolution over the immigration issue.
"Democrats are needed if it is to pass in the Senate - but they want illegal immigration and weak borders. Shutdown coming?" he said.
Democratic Senator Tim Kaine told reporters that lawmakers were close to a longer-term deal and should not pass another 30-day funding measure. "We can get there, were close enough we can get there if we just stay on it," he said. "I think we can get one in the next few days."
Republican Senator Tom Cotton said he was willing to provide protection to DACA recipients in future negotiations.
"We have another six weeks to solve that problem. It doesn't really involve government funding," Cotton told Fox News. "We should take those two issues up in sequence."
Republicans have a 51-49 majority in the Senate, but with Senator John McCain undergoing cancer treatment at home in Arizona they need at least 10 Democrats to reach the 60 votes required to pass a spending bill. In addition to strong Democratic opposition, at least three Republican senators have said they will not back the resolution in its current form.
Republican Senator Mike Rounds, who earlier said he could not back the bill, on Friday said in a statement that while the measure was "not ideal," he would support it after being assured that other legislation to adequately fund the U.S. military would be raised soon.
Three Democratic senators who are up for re-election this year in states Trump won in the 2016 presidential election said on Friday they would support the bill. But several other Democrats would still have to jump on board for passage.
Amid the deadlock, more senators were raising the possibility of merely approving enough new federal funds for a few days, as a tactic to put pressure on negotiators to then cut deals on immigration, defense spending and non-defense funding by next week.
But a White House aide said late on Friday that Trump would not support a deal that keeps the government open for just four or five days.
McConnell also shot down the idea. "Let's fund the government for a full month so we can actually get something done" and negotiate other issues including immigration, he said. (Reporting by Richard Cowan and Susan Cornwell; Additional reporting by Roberta Rampton, Steve Holland, Lisa Lambert, Blake Brittain and Amanda Becker; Writing by John Whitesides; Editing by Bill Trott, James Dalgleish and Leslie Adler)