Image copyright EPA Image caption The $1.1tn bill includes a provision to loosen regulations on financial instruments, angering Democrats

The US Senate has completed congressional approval of a controversial $1.1tn (£700bn) federal budget which will now be sent to President Barack Obama to sign.

The Senate passed the bill by 56-40 in a late-night vote on Saturday.

The budget had been the subject of months of intense cross-party debate, with both Democrats and Republicans making concessions.

The bill avoids a government shutdown which could have started next week.

Republicans sought to pressurise President Obama into abandoning controversial new immigration plans by ensuring only partial funding for the Department of Homeland Security.

From January onwards, Republicans will hold a majority in both houses of Congress, which they will hope to use to block the adoption of President Obama's amnesty program for some illegal immigrants.

Democrats were unhappy at the repeal of financial regulation clauses. But others said it was hard to vote against the bill considering its scope and the fact the Democrats will be in a worse position to negotiate next year.

The bill had already cleared the House of Representatives in a close and contentious vote on Thursday.

With the prospect of a government shutdown fast approaching, Congress twice passed emergency funding bills to buy more time for an agreement, with the latest extension coming earlier on Saturday.

Analysis - Kim Gittleson, BBC News, New York

Image copyright AFP

At the behest of Wall Street's biggest banks, Republican lawmakers had inserted a line that repealed one of the signature provisions of the 2010 Dodd-Frank financial reform bill.

This provision, Section 716, required banks to put portions of their riskier derivatives businesses into holding companies. The idea was to separate some of the bank's riskier trading in things like credit default swaps and commodities into a separate entity not insured by US taxpayers. But banks have balked at the rule since it was passed in 2010.

Citigroup, one of the country's largest banks, wrote a measure repealing the provision, and with help from JP Morgan's Jamie Dimon, managed to get Republicans to include it in the final $1.1bn budget bill.

Unsurprisingly, this angered many liberal Democrats - and even conservative Tea Party members - who saw it as a dirty play by Wall Street to force a Congress desperately in need of passing a spending bill into doing the banks' bidding.

US spending bill boon for Wall Street?

Image copyright AP Image caption Senator Elizabeth Warren (centre) has been sharply critical of the provision weakening financial regulation

The budget also adds emergency funding requested by Mr Obama, including funds to fight Ebola in West Africa and money for US air strikes against militant group Islamic State in Iraq and Syria.

The 1,600-page bill also included 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

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

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.