Olympic officials finally figured out what caused several pools built for the Rio De Janeiro Games to turn violently green: someone dumped 47 gallons of hydrogen peroxide into them.

The officials aren’t sure yet who decided to dump a boatload of hydrogen peroxide into their pools, but they have established that was the catalyst for the pools’ sudden color change. Hydrogen peroxide neutralizes chlorine when the two combine, which meant that certain “organic compounds” (i.e. algae, probably) could grow in the pool. And now, official say they’re gonna have to drain the whole thing and refill it before synchronized swimming starts on Sunday.

When the pools first turned green on Tuesday, officials were mystified as to why they suddenly had one blue pool, and one green one. They initially put it down to a chemical imbalance, which was technically correct, but still hadn’t figured out the root cause of the problem. Then, of course, the green pools started smelling like farts and barely reopened in time for the diving semifinals.

One pool, two pool, green pool, blue pool.
One pool, two pool, green pool, blue pool.

In most circumstances, hydrogen peroxide is a perfectly acceptable thing to clean a pool with — unless, of course, there’s already chlorine in there. Somewhere in the Olympic officials’ attempts to make sure the pools were clean, a maintenance worker dumped a bunch of hydrogen peroxide in there. When hydrogen peroxide and chlorine mix, they basically cancel each other out, which means that the previously sanitized pools were fertile environments for all kinds of gross green stuff, after a bunch of sweaty Olympians started jumping in and out of them.

Check out this video of hydrogen peroxide making short work of a chlorine tablet (note: don’t try this at home).

The problem was, Olympic officials didn’t realize the chlorine was neutralized. Because of the chemical reaction, the pool’s monitoring systems still thought the water was fully chlorinated. The monitors were reading that everything was hunky dory, even though the pools were going through the opening ceremony for the algae Olympics.

“The electronic monitoring system that measures the amount of chlorine in the water was betrayed by this chemistry,” Gustavo Nascimento, director of venue management for the Rio games, said at a press conference on Saturday.

The whole thing was pretty embarrassing for the already controversial Rio Games.

“Of course it’s an embarrassment,” Mario Andrada, a spokesman for the Rio Games, said at the press conference. “We are hosting the Olympic Games and athletes are here so water is going to be an issue. We should have been better in fixing it quickly. We learned painful lessons the hard way.”

Unfortunately, there’s no easy fix, and the pool workers are going to have to drain and refill the whole pool. Andrada said that they’ll have to drain out all 984,040 gallons of green water and put in clean stuff from a nearby practice pool. The whole operation should take about ten hours, Nascimento said — six to drain, four to refill — but they should be able to pull it off before the synchronized swimming on Sunday. Synchronized swimmers need to be able to see each other under the water, which is tricky in a murky-green algae-soup, so Olympic officials have no choice but to do a complete refresh. Here’s hoping they dump the right chemicals in it afterward this time.

Photos via Getty Images / Adam Pretty

Jack, Inverse's Associate News Editor, is based in Brooklyn. His work has appeared in Vice News, The Daily Beast, Roads and Kingdoms and others.