In its chemical processes the refinery was producing a by-product - coker naptha, a dirty form of gasoline which could not be treated on site.
The e-mails which Newsnight has obtained reveal that Trafigura executives realised they could make a fortune by buying the dirty Mexican oil for next to nothing.
One e-mail says: "This is as cheap as anyone can imagine and should make serious dollars."
However, to sell it on at a profit, Trafigura first had to find a cheap way to clean the coker naptha and lower its sulphur levels.
Trafigura chartered the Probo Koala and while the ship was off the coast of Gibraltar poured tons of caustic soda and a catalyst into the dirty oil to clean it - a rough and ready process known as "caustic washing".
The method is cheap, but it generates such dangerous waste that it is effectively banned in most places around the world.
The e-mails obtained by Newsnight show that in the months before the waste was dumped the company knew about the difficulties they would face in disposing of the waste.
"This operation is no longer allowed in the European Union, the United States and Singapore" it is "banned in most countries due to the 'hazardous nature of the waste'", one e-mail warns.
Another e-mail points out that "environmental agencies do not allow disposal of the toxic caustic".
The process left a toxic sulphurous sludge in the tanks of the Probo Koala.
Claiming that the waste was simply tank washings - the standard oil-water mixture produced by routine tank cleaning - Trafigura attempted to offload the waste in the Netherlands.
However, when the waste was offloaded the smell was so strong, the emergency services were called.
Samples were taken and Trafigura was told the waste was toxic and would cost hundreds of thousands of euros to treat safely.
However, Trafigura opted for the much cheaper option of reloading the waste and taking it elsewhere. It ultimately ended up in Ivory Coast.
Newsnight investigation from August 2007
Evidence seen by Newsnight shows that knowledge of the waste and problems getting rid of it went to the very top of Trafigura and the company's President Claude Dauphin.
The Trafigura e-mails say that Mr Dauphin was urging his team to "be creative" in how they dealt with the hazardous waste.
The contractor that they found in the end was Solomon Ugburogbu, the owner of a company called Tommy, which had no facilities to handle hazardous waste.
Ugburogbu, is now serving a 20 year sentence for poisoning local people.
Trafigura has always denied and continues to deny any liability for events that occurred in Ivory Coast.
In a statement to Newsnight on Wednesday the company said: "With regard to Trafigura's proposals for handling the treatment and disposal of the slops, Trafigura always sought to comply with the laws and regulations of the jurisdictions in which it operates."
In 2007 they paid £100m to the Ivorian government to "compensate the victims" amongst other things.
The government administered fund paid compensation to the families of 16 people whose deaths they believed were caused by the waste.
On Wednesday Trafigura admitted a "global settlement is being considered" for the victims who suffered lesser injuries.
A statement from the Ivorians' lawyers, Leigh Day and Company, confirms an offer has been made and says: "The claimants are very pleased and are keen to see the issue resolved."
Watch Newsnight's full report on Trafigura on Wednesday 16 September 2009 at 10.30pm on BBC Two, then afterwards on the BBC iPlayer and Newsnight website.
Newsnight worked in co-operation with journalists from The Guardian, Volkskrant in the Netherlands, NRK in Norway and Estonian journalists in preparing this report and with access to research papers held by Greenpeace and Amnesty International.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.