An operation is under way to tackle a leak from an effluent pipeline into the Firth of Forth.
The pipe carries waste water between BP's Hound Point Terminal and Dalmeny oil storage tank facility near South Queensferry where it is treated.
Lothian and Borders Police are treating it as a major incident.
There is not thought to be any risk to public health though the smell has been compared with that created by a "stink bomb".
The alarm was raised on Monday afternoon by a member of the public who noticed discoloured water running into the Forth.
Police initially set up a 100 metre exclusion zone around the scene but all roads in the area were re-opened by 11pm.
However restrictions for pedestrians remained in place close to the breach in the pipe and where the effluent is trickling into the Firth to prevent people from wandering near the liquid.
BP apologised to the public for any inconvenience and said they were working to resolve the problem. A spokesman for the firm said: "The source of the leak has been identified and every effort is being made to contain and stop it."
The company said that the pipe now carries waste water such as that used for cleaning purposes at the terminal and comprises rainwater, seawater and some impurities. In the past it carried ballast water used to keep tankers afloat as they are being loaded with oil in the Firth of Forth.
The Scottish Environment Protection Agency said it was monitoring the situation and had officers on the site. It is not known what impact the leak will have on the environment.Suggest a correction