Marcelliano Reitz, lean and toothless, rolls up his sleeve. The sun is setting behind the world-famous silhouette of Table Mountain. A plane on its way to Cape Town’s international airport flies low overhead. Children play on a rusting climbing frame, jumping on an abandoned mattress.

Reitz has only just returned to his home in the poor and violent neighbourhood of Bonteheuwel after five years in jail for a firearms offence. He is a member of the Americans, one of the area’s biggest and most violent criminal gangs. On his wrist is the tattoo that marks him out as also being a member of one of South Africa’s major prison gangs. Yards away, police search a line of teenagers turned to a wall.

You can be a tourist in the centre of Cape Town and be totally safe. But 10km away people are shooting at police Albert Fritz

“This is our territory,” says Reitz, 34. “Life is tough here but we have no problem with the police. They keep it stable. That is better for everyone.”

The police deployment in Bonteheuwel is part of a new effort by local authorities to stem soaring rates of violent crime on the Cape Flats, a vast sprawl inland of Cape Town that feels a world away from the beaches, restaurants and tourist sites on the other side of the mountain.

Few doubt the scale of the problem.

Bonteheuwel in the Cape Flats

“It’s been a bad year – but a really bad five years,” says Simone Haysom, author of a book on gang violence in Cape Town. “Until now, the government seems to have been willing to let the Cape Flats burn.”

After almost 1,000 murders in the first six months of this year alone on the Cape Flats, national authorities sent in the army, and armoured convoys have patrolled the rutted streets of the area’s worst neighbourhoods of the Cape Flats since July. The deployment was extended by South Africa’s president, Cyril Ramaphosa, in September.

Q&A What is South African cities week? Show Hide Twenty-five years after the fall of the brutal apartheid regime, South Africa's cities remain hugely divided, both economically and racially. This week Guardian Cities explores the incredible changes taking place, the challenges faced and the projects that bring hope. Africa correspondent Jason Burke reports from the Flats, where violence and death are endemic just miles from Cape Town's spectacular beaches and trendy cafes. Author Niq Mhlongo pens a love letter to the "other Soweto", one that visitors to gentrified Vilakazi Street never see. We hear from Port Elizabeth, where one architect is using recycled materials to transform his city, and Durban, where a surf school is changing the lives of vulnerable children. We explore the deadly underground world of zama zama gold miners operating illegally under the city of Johannesburg, visit the Afrikaner-only town of Orania and publish an extraordinary photo essay by Magnum nominee Lindokuhle Sobekwa, who documents life in a formerly white-dominated area where his mother once worked as a domestic helper. Nick Van Mead

The police patrolling in Bonteheuwel are from one of two freshly constituted units of Cape Town’s Metro force that are dispatched to some of the worst areas.

“The community is tired of the gangs, and criminals think twice if they see us in the area,” says the inspector who leads the team.

Through the evening and night, he and his dozen officers, all recruited locally, will stop and search a score of teenagers, raid a shattered, destitute house used solely by local drug addicts and search for firearms in squalid huts. Walls in the neighbourhood are marked with graffiti showing which gang is in control of each block.

Bonteheuwel was constructed in the 1960s by the repressive, racist apartheid regime that ruled South Africa until 1994. Apartheid planners purged Cape Town of black and mixed-race communities, dumping them in townships built without amenities or transport links on the sandy Cape Flats. Gangs developed rapidly from the mid-1990s onwards, recruiting among unemployed youth.

Street scenes in Nyanga

As violent crime has risen across South Africa since 2011, so too has gang violence on the Cape Flats.

“There are more criminal networks in South Africa now, more foreign networks and more criminal businesses,” says Haysom.

Statistics released in September show a total of 21,022 murder cases in South Africa reported between 1 April 2018 and 31 March this year, a 3.4% increase from the previous reporting period, leaving the country with one of the highest murder rates in the world. The worst police precinct in the country, Nyanga, is close to Bonteheuwel.

There has been a large reduction in gang violence in Bonteheuwel

Cape Town is run by South Africa’s main opposition party, the Democratic Alliance, further complicating the fight against gang violence. DA officials accuse the African National Congress, in power at national level for 25 years, of starving the province of police resources.

Albert Fritz, provincial minister for community safety, says violence on the Cape Flats has been very localised.

“It is really a tale of two cities,” he says. “You can be a tourist in the centre of Cape Town [and] you will be totally safe. You will not know that … 10km [6.2 miles] away there are people shooting at police.”

So far, the new deployment to Bonteheuwel has been a success. There were 44 killings in the first half of the year but there has been only one between June and mid-September; a hit on a gang leader.

Police patrol in Manenberg and Bonteheuwel

But a similar effort in Delft, a much bigger neighbourhood that lacks the strong community involvement that has taken place in Bonteheuwel, has had less impact, and there is little sign that the army deployment has improved the situation. By some measures, murders have increased.

“We must not give up … I am optimistic,” says Fritz. “The gangs … will always be there, but we can reduce their impact and power.”

One of the most notorious neighbourhoods is Manenberg, a crowded series of low-rise apartment blocks and battered two-room homes where a series of gangs – the Americans, Hard Livings, Fancy Boys, Dixie Boys and others – fight to control a lucrative trade in cannabis, crystal meth and sedatives.

Officers from Cape Town’s specialist anti-gang unit describe an anarchic free-for-all, with young criminals in their teens providing “cannon fodder” for wealthy criminals who live in big houses in sought-after suburbs well away from Manenberg’s rubbish-strewn streets.

Bonteheuwel in the Cape Flats

“The gangs build support among local residents by providing protection, handouts sometimes and keeping order,” says one officer. “That’s a problem for us. Everyone should be equal before the law, whoever they are.”

Investigations into major gang leaders are often stymied by corruption and fear.

Why are South African cities still so segregated 25 years after apartheid? Read more

Roegshanda Pascoe, an activist from Manenberg who witnessed a gang murder and agreed to testify against six men arrested for the killing, has faced attacks on her home and family. She has lived in a series of secret locations since the trial began, but has refused an official witness protection scheme that would have forced her to leave the region.

“I feel very hopeless,” says Pascoe, 44. “I will never be able to go home … But it’s not just about people in Manenberg, or in Cape Town … it’s about the whole nation.”

On the eastern fringe of the Flats, where the spectacular wineries and resorts that draw wealthy tourists from all over the world are clearly visible, is Mfuleni, an expanse of makeshift housing that is poor even by local standards.

Ayanda Tunce: ‘I am very worried about my kids and their future’

Ayanda Tunce, known as 2SLY, grew up in Mfuleni. He spent 10 years as a gangster and five years in prison.

Tunce, 34, once wanted to be a doctor. As a teenager he was running errands for gang leaders and got a criminal record. At 22, he robbed a local drug dealer of two handguns and set up his own gang, selling drugs and maiming rivals. Now a father of three, he lives in a two-room shack with no sanitation and says he has rejected crime.

“It is worse today,” he says. “Every weekend round here, we hear someone is dead, shot, raped, stabbed. There is too much heroin and tik [crystal meth]. I am very worried about my kids and their future. I am not asking the president. He’s got his own problems. It is only us who as citizens, who know our hoods, who can change things.”

Follow Guardian Cities on Twitter, Facebook and Instagram to join the discussion, catch up on our best stories or sign up for our weekly newsletter. Share your views here on how South African cities have changed in the last 25 years