In the hours before the Deepwater Horizon drilling rig exploded, BP pumped into the well an extraordinarily large quantity of an unusual chemical mixture, a contractor on the rig testified Monday.

The injection of the dense, gray fluid was meant to flush drilling mud from the hole, according to the testimony before a government panel investigating the April 20 accident. But the more than 400 barrels used were roughly double the usual quantity, said Leo Lindner, a drilling fluid specialist for contractor MI-Swaco.

BP had hundreds of barrels of the two chemicals on hand and needed to dispose of the material, Lindner testified. By first flushing it into the well, the company could take advantage of an exemption in an environmental law that otherwise would have prohibited it from discharging the hazardous waste into the Gulf of Mexico, Lindner said.

A BP specialist said using the two substances together would be okay. Nonetheless, the night before the rig exploded, Lindner was busy conducting an improvised chemistry experiment to double-check. He mixed a gallon of one of the substances with a gallon of the other and observed their reaction.

When the well became a gusher on April 20, a fluid that fit the general description of the mixture rained down on the rig.