RIO DE JANEIRO — Helicopters were up at daybreak spotting rubbish flows at the Olympic sailing venue, with boats below collecting the debris.

Dozens of barricades dammed up streams that flushed garbage into the bay. They caught waterlogged sofas, Styrofoam cups and deflated soccer balls.

A sewer pipe at Marina da Gloria stopped raw sewage from being pumped into the harbor where Olympic boats were moored.

Rio de Janeiro’s water remains filthy as the Olympics wrap up, even after a final push to clean up the water for the world’s largest sporting event. Fans were reminded by the stench from a lagoon contaminated with raw sewage that abuts the Olympic Park.

Long after the athletes and fans leave, the city will continue to struggle with water teeming with bacteria and viruses.

Rio organizers promised in their 2009 bid document that the Olympics would drive a cleanup of Rio’s waters, pledging to treat 80 percent of the waste. Estimates vary, but most suggest the area is still treating less than 50 percent of its sewage.

For two weeks, Olympic athletes competing in the water largely avoided falling ill by building immunity to pathogens, using preventive measures, or by trying to limit contact with the water in water-based sports.

An independent study by The Associated Press conducted at sites around the city over more than a year – including the sailing venue in Guanabara Bay and the rowing venue in Rodrigo de Freitas lagoon – showed dangerously high levels of contamination.

In over 16 months of testing leading up to the games, there was no decline in the very high bacterial and viral levels in the water, underscoring that the cosmetic measures authorities took to make venues appear cleaner ultimately didn’t reduce the risks.

“The contamination is always there, and the sad thing is that it’s not going away any time soon,” said Dr. Fernando Spilki, the Brazilian virologist and coordinator of the molecular microbiology laboratory at Feevale University in southern Brazil, who was commissioned by AP to conduct the water tests.

Falling ill depends on a variety of factors.

“The majority get infected, a few get sick and adults normally (have built up) some immunity,” Spilki added.

It is difficult to link symptoms to Rio’s water because many gastrointestinal illnesses can be blamed on things like simple travelers’ diarrhea, and some symptoms may not show up immediately.

Dr. Nebojsa Nikolic, medical director of World Sailing, said he’ll conduct a follow-up study after the Olympics.

“From what we know there were only a few cases scattered across different teams without influencing the sailing performance,” Nikolic said in an email.

Sailors and rowers said the water appeared cleaner than it was a year ago, the result of numerous stop-gap measures employed by the Brazilian government. Most of it focused on corralling floating trash, but officials also deployed bioremediation efforts during test events, but declined to specify exactly what it entailed.

“We had taken precautions just in case, because the water quality last year and the year before probably wasn’t that good,” said Lisa Carrington of New Zealand, who won gold in women’s 200-meter singles. “But I feel that the water here today, this week, is really good.”

Precautions taken by athletes across polluted venues included keeping water bottles in plastic bags, bleaching oars or paddles, using hand sanitizers, and washing clothes immediately after practicing or racing.

Brazilian canoeist Isaquias Queiroz said he’s trained in Rio for two years and noticed the “water is much cleaner.”

Dorian van Rijsselberghe of the Netherlands, who won gold in men’s windsurfing, criticized Brazilians for not keeping their promise to thoroughly clean the bay.

“Not everything is OK,” Van Rijsselberghe said. “That’s the thing. Brazil made a promise a couple of years ago and they couldn’t keep their promise.”