HOUSTON (Reuters) - BP Plc on Wednesday said it will spend $400 million to install pollution controls at its giant Whiting, Indiana refinery, to allow it to process heavy crude oil from Canada, in a deal with U.S. and state regulators. The deal, announced by the government and confirmed by BP, ends years of opposition that might have left BP unable to use $4 billion worth of new processing units being installed at Whiting that will allow it to run Canadian tar sands crude as early as 2013. BP has set plans to use Canadian crudes for more than 85 percent of the refinery's daily needs. To boost profits, U.S. Midwest refiners are looking to retrofit plants to process plentiful supplies of Canadian heavy oil, which is cheaper but also has a higher content of pollutants that cause acid rain, smog and haze. As part of the settlement, BP will install an estimated $400 million of pollution-control equipment at the refinery while finishing a crude slate expansion project. The agreement between BP and EPA will set a precedent for refiners seeking to upgrade their refineries to run tar sands crude in the future, environmental groups said. "Generally, pollution control is supposed to be based on the best available technology, so this will be a benchmark," said Eric Schaeffer of the Environmental Integrity Project, a former enforcement official at the EPA. The EPA has sought to reduce emissions at refineries, particularly from flaring devices that burn off unneeded petroleum supplies. In April the EPA reached a deal with Marathon Petroleum Corp to curtail flaring at its six U.S. refineries. An energy industry analyst said EPA's agreement with BP may not affect many other U.S. refineries because the Whiting crude slate changeover project is one of the last major projects currently scheduled. "I don't know of many more projects out there," said David Hackett, president of Stillwater Associates. BP is on the back end of those projects. Essentially the conversion of the Whiting refinery to run Canadian crude is switching the refinery from light, sweet crude to heavy, sour crude, which many Gulf Coast refineries have already done to Latin American crude grades. In a statement released on Wednesday afternoon, the Natural Resources Defense Council, which participated in opposition to BP's crude slate expansion, said the new pollution equipment will cut emissions from the Whiting refinery's flare system by 90 percent. It is easier to obtain for U.S. Midwest refiners because of its source in Alberta. BP currently processes between 70,000 and 80,000 barrels per day (bpd) Canadian crude at the Whiting refinery. After the project is complete, the refinery will be able to run up to 350,000 bpd in tar sands crude. Tar sands crude has drawn opposition from environmental groups because it has high levels of heavy metals, is corrosive and said to produce higher levels of air pollutants. Opposition to use of tar sands crude has temporarily halted TransCanada's Keystone XL pipeline project to bring the oil to refineries on the U.S. Gulf Coast. Opposition to the Whiting refinery's changeover to tar sands crude began shortly after BP announced plans to begin the $4-billion project in 2007. Local groups and politicians from President Barack Obama's home state of Illinois questioned BP's initial assumptions of pollution from use of tar sands crude. After Obama took office in 2009, EPA put a hold on a permit Indiana had issued to BP for the project, setting the stage for Wednesday's settlement.