By now, most people are familiar with the terrifying scene in the city of Beirut on Tuesday: an immense fire, red smoke billowing hundreds of metres into the air, followed by a jarring explosion with a rapidly expanding mushroom-like cloud that in the end killed at least 135 people and injured more than 5,000.Experts believe the cause of the explosion is linked to 2,750 tonnes of ammonium nitrate that had been stored at a warehouse at the port in Lebanon's capital since 2014.But what is ammonium nitrate — and how can it cause such a devastating explosion?What is ammonium nitrate?Ammonium nitrate is a chemical compound with the formula NH4 NO3, and it's made by combining ammonia with nitric acid. It is most commonly used as fertilizer for agricultural purposes — since it is highly soluble — but it is also used as an industrial explosive.The reason it's used as an explosive, said Andrea Sella, a professor of chemistry at University College London, is that it can be very efficient. "On the one side, the ammonium has hydrogen in it. The other side has oxygen in it. And there's nitrogen. And so when the two halves are forced in some way to come together, you get huge amounts of gas and huge amounts of heat out," he said.Ammonium nitrate has been used in terrorist attacks, such as the Oklahoma City bombing in 1995.WATCH | Massive explosion at port rocks Beirut:How dangerous is it?In small amounts, ammonium nitrate isn't dangerous, Sella said."It's an interesting molecule because you have these white crystals, which if you keep them in a jar will sit for years on your laboratory shelf. But on the other hand, given the right kind of kick, [it can] explode."That kick is an ignition source, particularly if ammonium nitrate is left over time and it can harden, which makes the explosive force much more devastating.Sella said the compound consists of ammonium and nitric acid, but "if you close the triangle, the fire triangle, and you provide ignition, then you're heading into very deep trouble." A fire triangle consists of ammonium, oxygen and the ignition.In the case of Beirut, the fire that was evident ahead of the explosion acted as the fuel. But one of the most dangerous aspects to ammonium nitrate is human complacency, said Miriam Diamond, a professor in the earth sciences department at the University of Toronto."There's a mythology that engineers and scientists have it all figured out," she said. "We don't actually, strangely enough. I have a degree in mining engineering, and I remember one of my profs who had a tremendous amount of experience said, 'One of the biggest threats is human failure.'"WATCH | Canadian visiting Lebanon describes impact of blast:And then there's the issue of storage. Oftentimes, as seems to be the case in Beirut, once ammonium nitrate is stored and out of sight, it's out of mind, Diamond said."It's both human error and sloppiness," she said. Has this kind of accident happened before?Sella said that one of the most notable accidents was in Oppau, Germany, in 1921, when ammonium nitrate being stored in a silo had hardened over winter. Finding it difficult to break apart to prepare for packaging, workers tried to use dynamite. The subsequent explosion levelled the town and killed 700 people.One of the most recent incidents was in 2015 in the Port of Tianjin, China."There are all kinds of regulations which govern how you store it, how long for, under what conditions and so on," Sella said. "But time and again, things slip, one thing leads to another. Eventually you're unlucky."Are the gases it produces dangerous?When ammonium nitrate is changed from a solid to a gas, one of the byproducts is nitrogen dioxide.But what about the Beirut case, where a massive amount of nitrogen dioxide was released into the atmosphere in one sudden explosion?"Because you have the fire in the first place, then the very hot explosion, the gas will actually be chimneyed effectively upwards," Sella said.That would make it unlikely that serious levels would remain at ground level, he said.Why did it produce a mushroom cloud?"Any big explosion gives us a mushroom cloud," said Cheryl Rofer, a chemist who retired from the Los Alamos National Laboratory in Washington, D.C."I think what threw a lot of people off and might have made them think it was nuclear was that spherical white cloud that formed and then dissipated rather quickly."And what most people associate with that type of cloud tends to be nuclear explosions.When the blast in Beirut occurred, it sent a shockwave that travelled faster than the speed of sound. The air was then compressed in front of the shockwave, and the air behind it expanded. It's something often referred to as a "Wilson cloud," Sella said, and typically happens when the air is humid.