Greg Toppo, and Erin Kelly

USA TODAY

Congressional negotiators on Sunday reached an agreement to fund the U.S. government through the end of September, three congressional aides told USA TODAY, averting a government shutdown at the end of this week.

The deal includes $15 billion in extra funding for defense programs, which is half of the $30 billion that President Trump asked for in his emergency request to Congress. It also includes $1.5 billion in extra money for border security, but not the $1.4 billion Trump wanted to begin construction of a wall on the U.S.-Mexico border. And it includes $2 billion in extra funding for the National Institutes of Health, which Democrats were pushing for, according to a source with the Senate Appropriations Committee.

The House and Senate are expected to vote on the package by Thursday.

On Friday, Congress passed a stopgap funding bill that kept the government open for another week, giving lawmakers until midnight May 5 to try to reach a compromise on legislation to fund the government through fiscal 2017, which ends Sept. 30. Negotiators from the House and Senate appropriations committees worked through the weekend to reach a deal.

Related:

Government shutdown less likely now that Trump has relented on border wall

Would a government shutdown hurt stocks?

Congress passes short-term funding bill to avoid government shutdown

After details of the agreement emerged Sunday night, Senate Minority Leader Chuck Schumer, D-N.Y., released a statement saying the deal reflects the Democrats' principles. The bill "ensures taxpayer dollars aren’t used to fund an ineffective border wall, excludes poison pill riders, and increases investments in programs that the middle-class relies on, like medical research, education, and infrastructure."

White House Budget Director Mick Mulvaney said earlier in April that the shutdown fight was "the first real test of whether or not the Democrats — specifically in the Senate — are interested in negotiating, interested in compromising."

The White House last week dropped its demand for immediate funding for the border wall after Democrats said it would result in a government shutdown because they would not vote for any bill that included it. The White House also dropped its threat to stop paying federal subsidies to insurance companies that offer lower-cost coverage to low-income Americans. Trump had threatened to stop paying the subsidies to force Democrats to support legislation to replace the Affordable Care Act, better known as Obamacare.

Once those two major stumbling blocks to a deal were removed, negotiators had just a few remaining issues to resolve over the weekend.

While Republicans hold majorities in the House and Senate, the GOP needs Democratic votes in both chambers to pass the funding bill. In the closely divided Senate, the GOP has a slim majority of 52 seats in a chamber where 60 votes are required to pass the legislation. In the House, Republican leaders need help from Democrats because some conservatives will oppose any bill that increases spending.

Democrats used that leverage to get concessions from the White House on the border wall and Obamacare while also getting extra money for medical research and other domestic programs. At the same time, Democrats agreed to beef up defense and border security, allowing the White House to claim at least a partial victory.

"We have eliminated more than 160 Republican poison pill riders, ranging from undermining a woman’s right to reproductive health to dismantling Dodd-Frank's vital Wall Street consumer protections," House Minority Leader Nancy Pelosi, D-Calif., said in a statement late Sunday. "The omnibus (funding bill) does not fund President Trump's immoral and unwise border wall or create a cruel new deportation force."

Pelosi said the bill includes more than $1 billion in permanent health benefits for retired coal miners and their families, additional funds to fight the epidemic of opioid addiction, and more money for Puerto Rico's Medicaid program, which was expected to run out of funds this year. It also restores student access to year-round Pell Grants to help pay college tuition and provides funding for federal highways and wildfire prevention, Pelosi said.

Follow Greg Toppo and Erin Kelly on Twitter: @gtoppo and @ErinVKelly