With thousands of liters of raw human sewage pouring into the ocean every second from Rio de Janeiro, August's Olympic Games have trained a spotlight on Rio's spectacular failure to clean up its waterways and world famous beaches. But just across the Guanabara Bay, its sister city of Niteroi is showing that a real cleanup is possible.

In Niteroi, 95 percent of sewage is treated and authorities say they are on track for 100 percent within a year, even though Rio's failure to do its part means that sludge still flows in from across the bay. Rio has not only broken promises made to fix its sewage problem in time for the upcoming Summer Games, but the state has been downplaying expectations, even suggesting it might be 2035 before a full cleanup happens.

Niteroi's success underscores key factors that stand in stark contrast to Rio: privatization of sewage management, major investment in infrastructure and a high level of accountability and collaboration between the city government and the utility to define targets and meet them.

In Rio's Olympic bid document seven years ago, authorities pledged that an extensive cleanup - which included collecting and treating 80 percent of the city's sewage - would be one of the games' enduring legacies, but it simply never happened: An ongoing study commissioned by The Associated Press has shown that rowers, sailors and marathon swimmers will be exposed to waters so filthy they're roughly equivalent to raw sewage.

Why did Niteroi succeed while Rio failed? For starters, it doesn't help that Jorge Briard, president of the Rio state-owned utility known by its Portuguese acronym as CEDAE, says he isn't sure where they came from. The utility is charged with meeting the Olympic bid goals.

'''Why didn't you achieve the 80 percent that was stated?' That's the recurring question,'' Briard said in an interview with The Associated Press. ''I always say, 'I don't know where the 80 percent came from. Certainly not from CEDAE.''

The situation in Niteroi in 1997, when a private sanitation company won a tender to manage the city's sewage system, was even worse than Rio's situation is now. About a third of the population didn't have running water and more than two-thirds of sewage went untreated.

Over the past 15 years, the city has rolled out new treatment plants and hooked up hundreds of thousands of homes, thus stopping untreated waste from flowing into area streams and rivers that run into the bay.

''City Hall got to the point where it had no other alternative but to look to the private sector for someone who could solve the big problems,'' said Carlos Henrique da Cruz Lima, planning director at Aguas do Brasil, the sanitation company.

It was a bold move. Similar situations existed, and continue to exist, throughout Brazil, and public utilities still outnumber private ones here by around nine to one.

The company has invested 500 million Brazilian reais (US$ 141 million) to expand the city's then-sole sewage treatment plant and build another eight units - as well as, crucially, to lay the pipes to transport the sewage.

By comparison, Rio treats about half its sewage - despite multibillion dollar cleanup efforts and broken promises stretching back more than two decades.

Briard, Rio's utility president, rejected arguments that his company had failed. He said ongoing infrastructure investment had boosted treatment of the city's sewage from a lackluster 11 percent in 2007 to 51 percent currently.

''It's a big advance,'' he said.

Briard said CEDAE's goal was to get to 90 percent treatment, but declined to provide a timeline. He also downplayed the accomplishments in Niteroi, saying Aguas do Brazil piggybacked on work already down by CEDAE, such as development of a subterranean network of pipes.

Sanitation experts say Niteroi has the advantage of being relatively small. The population is around 500,000 people, compared with Rio's 6 million.

That dynamic makes oversight and enforcement easier, cutting down on corruption in building contracts and management, long a scourge in Latin America's most populous nation.

In April, police investigators conducted a sting at several CEDAE waste treatment plants, collecting samples aimed at determining whether the facilities are just pumping raw sewage through and dumping it. Depending on the results, both CEDAE and its top executives could be charged with pollution and larceny.

For all of Niteroi's gains, a huge amount of sludge still makes its way from Rio. The two cities are separated by about 5 miles (8 kilometers) of bay water.

''It's been getting cleaner,'' said Renan Taboada, a 19-year-old from Niteroi as he played soccer on the city's showcase Icarai Beach, ''but it's definitely not as clean as we would like.''