A group of children gathered on the banks of the Ciliwung river in the Indonesian capital Jakarta, staring into the water and casting nets to try to catch fish.

Such a scene would have been unthinkable several years ago on the major river, which used to be heavily polluted with stinking rubbish that blanketed the water's surface.

The waterways that criss-cross the teeming, overcrowded city of 10 million inhabitants are getting a new lease of life after the local government began a programme to dredge and widen them in 2014.

"Much has been achieved, our rivers used to be very filthy," Isnawa Adji, head of the Jakarta environment agency, told AFP.

The rivers have been a central part of life for many in Jakarta for years, particularly those living in the poor slum areas that have grown up alongside them.

It is common to see adults and children swimming in the filthy water to escape Indonesia's searing, tropical heat, and small, wooden boats navigating the waterways.

As well as ridding Jakarta's 14 rivers of rubbish, authorities have pushed a programme of evictions to clear housing alongside the waterways, allowing them to be widened.

This is aimed at easing the floods that inundate Jakarta every year during the months-long rainy season but has also proved controversial, with activists accusing the government of tearing communities apart by forcing families from their homes.

Most of the main rivers have now been cleared of rubbish, said Adji, and the agency is now focusing on cleaning up more than 1,000 smaller waterways.

The narrow ducts typically run through slums, and residents have been dumping trash in the waterways for decades due to the lack of a decent rubbish disposal system in poor areas.

Activists praised the government's efforts, saying the livelihoods of those in riverside communities had improved, but urged authorities to do more to stop people illegally dumping rubbish.

"We need to strictly enforce the law against people who throw their waste in the rivers," said Abdul Kodir, founder of group "The Ciliwung lovers' community".