Officials say the malodorous problem in the Rodrigo de Freitas lagoon is 300 years old but soon will be coming to an end

There has been an unholy stink below the right armpit of the Christ the Redeemer statue in Rio de Janeiro at times this year, but city officials insist it will soon be a thing of the past thanks to a 40m reals engineering project.

The smell – which has sporadically plagued the "Marvellous City" for centuries – emanates from the seasonally fetid waters of the Rodrigo de Freitas lagoon, which will be used as the venue for rowing events during the 2016 Olympics.

Surrounded by spectacular hills, bordered with mangrove trees and home to kingfishers, herons, urubus and frigate birds, the lagoon is a magnet for the thousands of cyclists, joggers and walkers who circle its 7.5km perimeter each day.

But the beautiful scene is not always matched by the smell.

So foul were the waters in March that tens of thousands of dead fish had to be scooped off the surface.

The odour has raised questions about the city's efforts to clean up and modernise in time for the World Cup and Olympics. Some have voiced suspicions of corruption and inefficiency because the smell seemed worse than ever this year despite the large sums of money that have been spent in recent years to reduce pollution.

City officials and academics say such accusations are mistaken. The malodorous annual phenomenon, they argue, is at least 300 years old and will soon be coming to an end.

The lagoon, which sits between Ipanema and the Tijuca forest, was once three times its current size, but it has been gradually diminished by landfill projects as Rio spread from its colonial centre to the tourist resorts along the coast.

The lagoon is fed by sea water via a canal from the Atlantic and fresh water that cascades down from the surrounding hills via three rivers. The result is a fragile ecosystem of brackish water with a very low oxygen content of between 0.5 and 0.9% that is quickly sucked up by spawning fish and the organic matter that is carried from the forests during the autumn rainy season.

Sewage discharges also plagued the lagoon for decades, but government officials and academics say this has improved considerably in recent years as a result of a Lagoa Limpa (Clean Lagoon) campaign.

"Pollution used to be a major factor but not any more," said the deputy head of the city's environment department, Altamirando Fernandes Moraes. "The lagoa is no longer considered polluted. It's now classified as 'recreational quality'. You can swim in it."

It is hard, however, to find any locals willing to take a dip. Officials admit there are still 13 "irregular" waste pipes discharging into the canal, which connects the lagoon to the sea. The latest monitoring data also shows that effluent is also still being discharged from at least four points around the lagoon, less than half of which is currently deemed suitable for recreational use.

Eike Batista – a Rio native who is one of the world's richest men and, apparently, an occasional perambulator around the lagoon – has been involved in the Lagoa Limpa clean-up, donating 23m reals to a pipe upgrading project. His involvement has recently come to an end. Some locals believe that is because he has lost three-quarters of $30bn fortune in the past year and see the worsening smell as a sign that the clean-up funds are drying up. Officials say this is just a coincidence.

Speculation about the cause of the smell has also focussed on the wide inequality between the wealthy neighbourhoods close the lagoon and the favela slums on the hillsides, many of which still have open sewers that flood each February and March. Some blame the poor infrastructure in the favelas. Others suspect rich condominiums around the lagoon are bribing officials to secretly discharge their waste.

Moraes dismisses such rumours. The biggest problem, he says, is an unloved species of fish called the savelha, or menhaden, which spawns in the lagoon. After the eggs hatch in January and February, the fish grow until there is no oxygen left in the lagoon. Birds won't eat them because of their spiny skin and fisherman are reluctant to catch them because the flesh tastes awful. Even dog food factories have turned their nose up at these fish, which are left to die because the link to the sea is too narrow for them to leave at this time of the year, Moraes says.

Eduardo Pacheco Jordão, a professor at the Federal University of Rio de Janeiro, is less inclined to blame the savelha, though he agrees the problem is historic and organic rather than recent and sewage-related.

"History shows this happens whenever there is a sharp fall of the temperature," he says, explaining this causes muddy, organic material on the bed of the lagoon to rise to the top. As it degrades, it sucks the oxygen out of the water. "It's a very old problem. And people have known what to do about it for many years – improve the rennovation of water in the lagoon by widening and deepening the canal from the sea – but they'd rather put up with the occasional smell than the construction."

That may have been true in the past, but with the world about to visit Rio for the World Cup and the Olympics, officials are pressing ahead with an alternative deodorising scheme.

The city and national government recently approved a plan to build four, 2.8 metre diameter pipes under Ipanema at an estimated cost of 40m reals. This would allow more oxygen into the waters of the lagoon and make it easier for the savelha to swim out. Another 20m reals will be spent on expanding the nearby beach of Leblon, which has been steadily losing sand to the canal. Bidding on the contract is due to start around August.

"We plan to have it finished before the Olympics. By then, there will be no dead fish and no bad smell," Moraes promises. Countless noses will hope he is right.

• This article was amended on 1 May 2013. The smell is coming from beneath Christ's right armpit, not his left.