Image copyright Reuters Image caption Arguments over border funding remain

US congressional leaders have reached an agreement on a $1.1tn (£701.6bn) spending bill ahead of a looming Thursday evening deadline.

The agreement funds most of the government until September 2015, preventing a government shutdown.

But one US agency would only be funded for several weeks as Republicans seek to confront President Obama over immigration policy.

The party won control of both the House and Senate in November's elections.

Democrats, who control the Senate until early next year, have said they will wait to see the final measure before putting their weight behind it, but the bill was negotiated by leaders in each party and is expected to pass.

"The federal government's going to run out of money in two days... We've been trying to work with Republican leaders to avoid a shutdown," Senate Majority Leader Harry Reid said on Tuesday.

Image copyright AP Image caption The Senate is led by Democrat Harry Reid, but not for much longer

The bill funds the government at the same levels that were negotiated last December.

It also adds emergency funding requested by President Barack Obama, including funds to fight Ebola in West Africa and money for US air strikes against Islamic State in Iraq and Syria.

Representative Hal Rogers, the Republican chairman of the House Appropriations committee, said the measure "will allow us to fulfil our constitutional duty to responsibly fund the federal government and avoid a shutdown."

But funding for the Department of Homeland Security, which includes US border security, is only extended to 27 February.

Image copyright AP Image caption John Boehner said the House will take up the bill on Thursday

Republicans are expected to try to use the expiration as leverage to force Mr Obama to roll back a executive action that ended the threat of deportation for about five million of the estimated 11 million immigrations living in the US illegally.

Representative Kevin McCarthy said the bill "sets up a battle" with the president on immigration and "his illegal action".

The 1,600 page bill also includes a number of provisions intended to gain votes from both parties, including:

increasing the amount an individual person can contribute to a national political party from $32,400 to $324,000

blocks the District of Columbia from using its own funds to set up regulatory systems for marijuana legalisation

measures that would significantly weaken new regulations about risky financial instruments called swaps

blocking certain Environmental Protection Agency (EPA) regulations

cuts in the budgets of the EPA and the US tax agency

increases in the budget for Wall Street regulation agencies, including the Securities and Exchange Commission.

A vote in the House is expected on Thursday, while the Senate will likely take it up on Friday or later.

In the meantime, Congress is expected to pass a short-term spending bill to prevent a shutdown.

White House spokesman Josh Earnest said Mr Obama would have to "look at the whole package" before deciding whether to sign the bill.