Fish farms have proved controversial in the estuaries of north Atlantic salmon rivers and in the Mediterranean, with anglers and environmentalists claiming their byproducts are seriously damaging the natural habitat.

But a project in Germany aims to feed growing urban populations by bringing aquaculture into town centres, putting tanks on rooftops and car parks and using the waste to grow vegetables.

The idea is simple. Perch swim in metal water tanks and the ammonia they excrete is used to fertilise tomatoes, salad leaves and herbs growing in a greenhouse mounted above. Aquaponic fish and vegetable farms aim to provide a self-contained system designed to provide city dwellers with organic, sustainable locally grown food.

"We have to think about systems which allow us to produce food in a very resource-efficient way," the co-founder of Efficient City Farming, Nicolas Leschke, said as he showed visitors around the small container farm prototype in the yard of a former malt factory in the Schöneberg district of Berlin.

Alarmed by overfishing of the oceans, spiralling food miles and what he calls a "general lack of transparency" in the food industry, Leschke and his colleagues are marketing their prototype as a basis for large aquaponic farm systems in German cities, with two in the planning stages.

Construction will begin next year on a 7,000 square-metre aquaponic farm on the roof of the disused factory in the German capital, which, when finished, will be the biggest in the world.

"The oceans are overfished and you don't have to be a prophet to know that's not going to change," Leschke said. "Also, with all the pesticides, antibiotics and genetic modifications, we just don't know what we're eating anymore."

Mounted on stilts, the Efficient City Farming containers can be set up almost anywhere, Leschke said, and farmers must only keep the water topped up and feed the fish. A small electric current is also needed to pump nitrate-enriched water from the fish tanks up to the hydroponic vegetable garden above. "As long as you add water, electricity and fish food these hi-tech gardens will last indefinitely," he added.

The Astaf Pro system, developed by scientists at the Leibniz institute in Berlin for the Efficient team, allows aquaponic farmers more control over nitrate levels in the water to maximize yields of fish and vegetables. And with urban populations set to increase over the coming decades, there will be plenty of mouths to feed. Half of the global population are city dwellers, a figure the UN says will swell to almost 70% by 2050.

Still, the idea won't save the world overnight, as the cost of the technology – up to €35,000 for a single container – means only larger farms with bigger yields are economically viable. "Our products aren't cheap. We aren't the solution to world problems, but it's a step in the right direction," Leschke said.