WASHINGTON (Reuters) - Republican and Democratic leaders in the U.S. Congress late on Wednesday unveiled a $1.3 trillion bill to fund the government through September, which includes an additional $80 billion in national defense spending but fails to fund some of President Donald Trump’s immigration initiatives.

If passed by the House of Representatives and Senate by a Friday midnight deadline, it would avert the shutdown of many federal agencies and programs beginning this weekend, when existing funds expire.

Earlier on Wednesday, the White House indicated Trump would support the measure, potentially ending a prolonged debate over spending priorities for the fiscal year that began last Oct. 1.

The Republican-controlled Congress will need Democratic support to pass a bill that many Republican conservatives are likely to balk at because of its cost.

Representative Mark Walker, who heads a large group of House conservative Republicans, complained that the bill will add to budget deficits. “It is imperative that we curb Washington’s out-of-control spending addiction that has not been slowed under Republican rule,” Walker said.

Senate Democratic leader Chuck Schumer touted the measure. “From opioid funding to rural broadband, and from student loans to child care, this bill puts workers and families first,” he said in a statement.

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 nearly $1.6 billion more for border security this year.

Republicans said that money will help with more than 90 miles of “physical barrier construction” along the southern U.S. border “for replacement (of existing barriers), bollards, and levee improvements.”

Democrats said the money would not be used for any new concrete wall.

The Department of Homeland Security would get an additional $7 million to hire 351 new Customs and Border Protection agents. But the legislation would not give Trump money for the significant increase in Immigration and Customs Enforcement agents he sought as part of a plan to expand deportations of undocumented immigrants.

Besides containing the largest increase in defense spending in 15 years, the bill would provide a significant boost in non-defense spending.

And it would fix a “grain glitch” included in the tax law enacted at the end of last year.

U.S. President Donald Trump, flanked by Senate Majority Leader Mitch McConnell (R-KY) and House Speaker Paul Ryan (R-WI), takes the stage to address the Republican congressional retreat at the Greenbrier resort in White Sulphur Springs, West Virginia, U.S. February 1, 2018. REUTERS/Jonathan Ernst

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, congressional aides said.

It would also include new money for infrastructure, combating Russian election hacking and some modest gun legislation following a series of mass shootings at American schools, churches and other public spaces.

The bill calls for tightening gun sales background checks, but falls far short of Democratic demands to close loopholes that currently allow some gun sales to go unchecked.

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.

Another $380 million is planned for grants to states to secure U.S. election systems.

Democrats said the bill will help fund the Gateway rail tunnel under the Hudson River connecting New York and New Jersey and serving both Amtrak and New Jersey commuter trains, which Trump opposes.

But a Republican aide said that funding will be at the discretion of the Trump administration.

If approved by Congress and signed into law by Trump, the bill would take budget squabbling off the table in Congress for the next several months, allowing lawmakers to focus on their November re-election efforts.

Lawmakers have been arguing since early 2017 about funding for the current fiscal year. 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.