(Adds details of bill)
WASHINGTON, March 21 (Reuters) - President Donald Trump, in talks with congressional leaders on Wednesday, backed a $1.3 trillion spending bill meant to avert a U.S. government shutdown, even though it is expected to exclude some of his specific immigration-related funding requests.
The bill has not been formally unveiled, but aides said it will be released soon, with lawmakers hurrying to approve it and send it to Trump for enactment before a midnight Friday shutdown deadline, the latest in a series of such scrambles in 2017-2018.
The White House said in a statement that Trump, Senate Republican leader Mitch McConnell and House of Representatives Speaker Paul Ryan "discussed their support for the bill."
They talked about their shared priorities secured in the omnibus spending bill," the White House said.
Trump at one point wanted $25 billion included in the bill to fully fund construction of his proposed U.S.-Mexico border wall, but negotiations with Democrats to make that happen fell apart early this week, according to congressional aides.
Instead, Trump will get $1.6 billion more for border security this year, aides said. The White House said it will help pay for more than 100 miles of wall. A source familiar with the negotiations said the legislation would fund 33 miles of new border fencing and levees, but not a concrete wall.
Major bills in the Senate generally need 60 votes to advance, meaning at least nine Democrats will have to support voting on the spending package.
The source said the bill will not pay for more immigration detention beds or hiring more U.S. Immigration and Customs Enforcement agents, which Trump had sought to help advance his goal of deporting more undocumented people.
The bill will also allocate money for the Gateway rail tunnel under the Hudson River connecting New York and New Jersey and serving both Amtrak and New Jersey commuter trains, the source said, despite a veto threat by Trump.
Congressional aides said the bill will include new money for the Pentagon, infrastructure, combating Russian election hacking and some modest gun legislation, as well as a fix to a "grain glitch" in last year's major tax law overhaul.
The bill will provide a $307 million increase above the administration's request for counter-intelligence efforts to fight Russian cyberattacks in 2018, when mid-term congressional elections will be held, and $380 million for grants to states secure U.S. election systems.
The "grain glitch" is a mistake in the tax bill approved in December, as the bill's Republican authors describe it.
Big grain buyers, such as Anheuser Busch, Cargill and the ethanol industry, have complained that the glitch gives lucrative tax breaks to grain producers for selling to farming cooperatives, and a lesser break for selling to agriculture companies.
In exchange for supporting the inclusion of the grain fix, Democrats secured the addition of a bipartisan proposal to expand a low-income housing tax credit, several aides said.
Other components of the bill will be $10 billion in infrastructure spending for highways, airports and railroads and an increase of $2.8 billion to fund opioid addiction treatment, prevention and research, a congressional source said.
Republican and Democratic congressional aides told Reuters that leaders plan to unveil their spending plan on Wednesday.
A senior Republican source said improvements to existing background checks on gun buyers would be included, as would a measure to help schools prevent gun violence. These steps, after recent school shootings, fell short of Democrats' calls for far tougher background checks and a ban on assault-style weapons.
The bill was expected to fund the government through Sept. 30, taking budget squabbling off the table in the Republican-dominated Congress for the next several months and allowing lawmakers to focus on their November re-election efforts.
Lawmakers have been arguing since early 2017 about funding for the current fiscal year, which began last Oct. 1. Since then, several temporary funding measures have been enacted. Two brief government shutdowns recently occurred due to Congress' inability to pass appropriations bills in a timely way.
If approved by the full House and Senate, the bill would fund the biggest U.S. defense buildup in 15 years. Also added was $2.8 billion to fight opioid addiction and $2 billion for military veteran health facilities, a congressional source said. (Additional reporting by Susan Heavey and Lisa Lambert Editing by Kevin Drawbaugh, Bill Trott and Leslie Adler)