Democratic and Republican leaders on Thursday agreed a deal to rescue a crippled overhaul of US immigration laws, which would offer a path to citizenship for 12 million illegal immigrants.

The bill, one of President George W. Bush’s last hopes for a signature domestic achievement in his second term, collapsed in the Senate last week, against stiff opposition from conservative Republicans.

“We met this evening with several of the Senators involved in the immigration bill negotiations,” Senate Majority leader Harry Reid and his Republican counterpart Senator Mitch McConnell said in a joint statement.

“Based on that discussion, the immigration bill will return to the Senate floor after completion of the energy bill.”

That timeline would mean the bill would be unlikely to return to the Senate before the end of next week at the earliest.

The deal was reached after hours of intense talks between senators who framed the original “grand bargain” to grant a path to legal status to illegal immigrants, strengthen border enforcement and initiate a low wage guest worker program.

The sweeping overhaul would also replace the current family-dominated immigration system with a merit-based points formula and attempt to cut a huge backlog for permanent resident green card applicants.

The breakthrough came hours after Bush backed a 4.4-billion-dollar burst of immediate spending to secure US borders, in a bid to revive the moribund bill.

“This funding will come from the fines and penalties that we collect from those who have come to our country illegally,” Bush said.

The two Senate leaders did not provide any details of the plan. However, sources close to the negotiators earlier said that it would include the chance for members to offer up to 20 amendments to the legislation.

It was not clear if the deal would be sufficient to appease conservative Republicans who have vowed to bring the measure down, branding it an “amnesty” for those who have entered the United States illegally.

Reid pulled the legislation from Senate floor last week, when it failed to attract the 60 votes needed to end debate and move to a final vote.

He said he would only bring it back when Republicans provided assurances that they had the required votes to force the measure through, pointing out that 80 percent of Democrats in the chamber already backed it.

Currently, Democrats have 49 members in the 100-seat Senate, and can usually count on the votes of two independent senators.

Bush agreed to the extra funding two days after he heard a chorus of complaints from conservative Republicans who said the current bill did not do enough to secure US borders.

White House spokesman Tony Snow said that money immediately spent on the issue would be repaid from fines and costs incurred by people who travel to the United States illegally.

It “would be effectively a mandatory spending account that would be continuously funded by fees and collection through the law. So all the money would always be set aside for border enforcement,” he said.

Even if the bill passes the Senate, it is assured of a rocky welcome in the House of Representatives, where members face reelection every two years, and so may be more prey to pressure from lobby groups outside Congress.

Republican representative Duncan Hunter said Thursday that Bush’s latest move would do nothing to garner conservative support for the bill.

“The security of American borders should not be conditional on amnesty,” said Hunter, who is mounting a long-shot campaign for the 2008 Republican presidential nomination.

“I am hoping and I am optimistic that the bill will fail in the US Senate. If it should make it through the US Senate, once again, the people’s House, the House of Representatives hopefully will stop this bill,” he said.