Officials said Saturday they had finally figured out why an Olympic diving and swimming pool suddenly turned dark green during the Rio Games.

Matt Dunham / AP

Rio Olympics officials said they have finally solved the mystery of why the waters in two competition pools turned emerald green this week. After days of leaving officials and spectators bewildered — and kind of grossed out — officials said Saturday a contractor had mistakenly dumped 160 liters of hydrogen peroxide into the water. The hydrogen peroxide then had an adverse reaction with the chlorine in the water, neutralizing the chlorine and allowing "organic compounds" to grow, including algae.

Matt Dunham / AP

Saturday's announcement came after spectators around the world watched for days as the waters of an Olympic diving pool turned dark green, contrasting sharply with a blue pool right next to it. "Of course it is an embarrassment because we are hosting the Olympic Games," Mario Andrada, spokesperson for the games, said during a press conference, the Associated Press reported. "We could have done better in fixing it quickly. We learned a painful lesson the hard way."

Laszlo Balogh / Reuters A doctor treats Hungary's Gergo Zalanki with eyedrops due to the water conditions.

Despite finding an answer to the water's color, Olympic officials said they would not be able to clean the water quickly, and they will begin draining the pool on Saturday, transferring nearly 1 million gallons from another nearby pool. The draining and transfer is expected to take 10 hours, but officials said they hoped to have it ready for the synchronized swimming competition. Athletes have complained about the murkiness of the green water, and some said their eyes hurt after using the pool. Andrada said the green water did not pose a health risk to the athletes.