By Richard Cowan, Reuters–

Negotiators in the U.S. Congress reached a deal late on Sunday on around $1 trillion in federal funding that would avert a government shutdown later this week, while handing President Donald Trump a downpayment on his promised military build-up.

The full House of Representatives and Senate must still approve the bipartisan pact, which would be the first major legislation to clear Congress since Trump became president on Jan. 20.

Prompt passage of the legislation was expected this week.

The funds, which should have been locked into place seven months ago with the start of fiscal 2017 on Oct. 1, would pay for an array of federal programs from airport and border security operations to soldiers’ pay, medical research, foreign aid, space exploration, and education.

“The agreement will move the needle forward on conservative priorities and will ensure that the essential functions of the federal government are maintained, said Jennifer Hing, a spokeswoman for Republicans on the House Appropriations Committee.

If it is not enacted by midnight Friday, federal agencies would have to lay off hundreds of thousands of workers and require many others to continue on the job providing law enforcement and other essential operations without pay until the funding dispute in Congress is resolved.

“This agreement is a good agreement for the American people and takes the threat of a government shutdown off the table,” Senate Democratic leader Chuck Schumer said in a statement.

He said the measure would increase federal investments in medical research, education, and infrastructure.

House and Senate appropriators worked into the night to draft the legislation for lawmakers to review.

A senior congressional aide said the Pentagon would win a $12.5 billion increase in defense spending for the fiscal year that ends on Sept. 30, with the possibility of an additional $2.5 billion contingent on Trump delivering a plan to Congress for defeating the Islamic State militant group.

Trump had requested $30 billion more in military funds for this year after campaigning hard on a defense build-up during the 2016 election campaign.

NO WALL MONEY

Several other important White House initiatives were rejected by the Republican and Democratic negotiators, including money for a wall on the U.S.-Mexico border that Trump has argued is needed to stop illegal immigrants and drugs.

Instead, congressional negotiators settled on $1.5 billion more for border security, including more money for new technology and repairing existing infrastructure, the aide said.

The Trump administration had earlier backed away from a threat to end federal subsidies for low-income people to get health insurance through Obamacare, the program that Trump had pledged to repeal.

Republicans are struggling over a repeal and replacement plan for former President Barack Obama’s landmark healthcare law and it was unclear whether they would be able to bring such legislation to the House floor soon.

While Republicans control the House, Senate and White House, Democrats scored other significant victories in the deal.

Puerto Rico would get an emergency injection of $295 million in additional funding for its Medicaid health insurance program for the poor, according to the aide who asked not to be identified. The impoverished island, which is a U.S. territory, is facing a severe Medicaid funding shortfall.

Democrats also fended off potential cuts to women’s healthcare provider Planned Parenthood, while House Democratic leader Nancy Pelosi applauded a nearly $2 billion hike in funds for the National Institutes of Health this year.

Coal miners and their families facing the loss of health insurance next month would get a permanent renewal under the spending bill.

While Trump has urged Congress to impose deep cuts to the Environmental Protection Agency, most of its programs would be continued for at least the remainder of this year, according to the aide.

The House is likely to vote first on the package, probably early in the week, and send the measure to the Senate for approval before Friday’s midnight deadline.

If the legislation is enacted by week’s end, Congress would then have to begin focusing on a series of bills to fund the government at the start of the next fiscal year on Oct. 1.

(Reporting By Richard Cowan; Editing by Paul Tait)