BP said it had installed a cap meant to halt the flow of oil from its ruptured Gulf of Mexico well on Monday and the Obama administration issued a new moratorium on deepwater oil drilling.

The British energy giant said it had installed the 40-ton containment device on the sea floor a mile beneath the ocean surface and said the stack completes the installation of the new sealing cap.

BP said it would test the integrity of the well and the ability of the device to completely seal off the flow of oil on Tuesday. If it works, it would mark the first time since the well blow-out on April 20 that BP has managed to halt the leak, if only temporarily.

But BP said success was not certain. The sealing cap system never before has been deployed at these depths or under these conditions, and its efficiency and ability to contain the oil and gas cannot be assured, it said in a statement.

Depending on tests of the device, BP will either keep it closed entirely or use it to resume siphoning oil to ships on the surface. If it works effectively, the cap should either hold all the oil in or allow it to be safely captured and funneled to the surface.

BP said it will permanently block the oil flow in August with a relief well being drilled deep beneath the seabed which will intercept the original well and plug it.

Interior Secretary Ken Salazar unveiled the new deepwater drilling moratorium, worded differently from an earlier drilling ban after a U.S. appeals court struck down the original moratorium last week.

Shares in BP surged and sources said the British energy giant is in talks with U.S. energy concern Apache Corp and others to sell assets worth up to $10 billion.

Announcing the new moratorium, Salazar said: I am basing my decision on evidence that grows every day of the industry's inability in the deepwater to contain a catastrophic blowout, respond to an oil spill and to operate safely.

The new ban will extend until November 30 and affects the same drill rigs as before, although it is based on types of drilling technologies rather than on water depths as the old one was.

President Barack Obama is under pressure to make offshore drilling safer and hold BP accountable as the spill hurts multibillion dollar tourism and fishing industries across all five states along the Gulf of Mexico.

The oil industry reacted to the new drilling ban by saying it would make matters worse.

It is unnecessary and shortsighted to shut down a major part of the nation's energy lifeline while working to enhance offshore safety, said American Petroleum Institute CEO Jack Gerard. It places the jobs of tens of thousands of workers in serious and immediate jeopardy and promises a substantial reduction in domestic energy production.

LEGAL CHALLENGES

Analysts said the oil industry was likely to contest the new ban in court, but drilling was unlikely to resume any time soon given the prospect of lengthy legal battles.

The White House was confident the new moratorium would stand up in court, spokesman Robert Gibbs said.

Fear of new rules and regulations has already led many drillers to slow their exploration in the Gulf of Mexico, and some energy analysts have said the hesitation could last longer than six months.

In New Orleans, Obama's independent oil spill commission held its first hearings on the impacts of the spill and of the drilling ban.

Michael Hecht, of the development agency Greater New Orleans Inc, told the hearing a drilling freeze threatened 24,000 jobs in Louisiana alone.

The panel of seven engineers, environmentalists and former politicians is investigating decisions by oil companies and government regulators that may have led to the disaster. Its findings will be crucial to any new regulations put in place and an eventual relaxation of the drilling ban.

BP shares surged more than 9 percent in London and nearly 8 percent in New York on Monday, driven by potential asset sales and hopes for a new system to capture almost all the oil.

It's probably worth more than what it's trading for right now if they can ever get this well capped and get the clean-up effort really going, said Ted Parrish, a co-portfolio manager at Henssler Equity Fund in Georgia.

The asset sale talks are at an exploratory stage and it was uncertain whether any plans would be advanced enough to be disclosed before BP announces second-quarter earnings this month.

BP owns a 26 percent stake in Alaska's Prudhoe Bay, the largest oilfield in North America and one of the 20 largest ever discovered.

BP and Apache declined to comment on reports of the talks.

BP, which said the cost of the spill was now about $3.5 billion, expects its first relief well to reach the blown-out well late this month, a first step in finally plugging the gusher by the first half of August as planned.

As several previous attempts to contain the oil have failed, BP is preparing a backup if the relief wells do not succeed. BP said it could install a new permanent oil-capture system by late August or early September.

(Additional reporting by Kristen Hays in Houston, Alexandria Sage in New Orleans, Jeff Mason and Richard Cowan in Washington, Matthew Lynley and Matt Daily in New York; Writing by Timothy Gardner; Editing by Simon Denyer and Chris Wilson)