Power of good … Selline Korir, director of the Kenya Tuna Uwezo project, sits in front of a banner during a peace caravan. Photograph: Global Communities

In a dim, mud-walled hall in a Nairobi slum, about 50 people from the local community have come to meet their new chief; a demure, petite lady in a white jacket with black piping.

Around the edges of the room, young men, some wearing caps at rakish angles, stand silently. These are the men Selline Korir, a peace activist, has come to see. But first Korir, 49, who works for non-profit Global Communities, will speak to the audience.

"Let us deal with our tribalism, our negative ethnicity, hapa [here, in Swahili], hapa, hapa," she says, before rallying the crowd to chant, "Tuna Uwezo" (We have the power).

Afterwards, Korir and her colleague John Okanga sit down at a fragile table; they are joined by five men and one woman, aged between 26 and 39. These are the leaders of the Kiambiu Youth for Peace and Development (KYPD) – but, not so long ago, they were among the most fearsome gang members in this small, fractured slum.

The meeting is tortuous, fraught and over three hours long. At one point, a young man who has been taking careful notes is beckoned outside by a passing police officer. He is immediately arrested for allegedly committing a robbery. Nobody seems to know whether he is guilty.

This is what gritty, time-consuming peace-building looks like as Kenya heads towards its most critical and complex election since independence from Britain 50 years ago.

Although all the candidates have pledged to respect the results, Kenyans are mindful of the ethnic and political violence that claimed more than 1,200 lives last time a president was elected, in 2007.

In Kiambiu, a mixed settlement with a history of violent conflict because of housing disputes, people were driven from their homes or killed as the political turmoil fed off tribal animosities that formed during elections in the 1990s and were crystallised by gang feuding.

The project aims to strengthen community and civil society networks in Kiambiu, Korogocho, Mathare, Kibera and Babadogo – some of the many Nairobi slums where youth unemployment is high, basic services are scarce, and gangs operate freely in a parallel universe mostly devoid of any state presence.

The aim is to get people talking, so that they don't end up fighting. Young people are key to this. With 80% of Kenya's unemployed aged between 15 and 34 (pdf), this demographic is ripe for exploitation by unscrupulous politicians with money to buy discord.

In Kiambiu, the Tuna Uwezo project reached out to gang leaders, making connections and encouraging dialogue. Last October, members of the rival Taliban and Mungiki gangs – consisting, respectively, of people from the Luo and Kikuyu ethnic groups – met for the first time in a decade.

"These are people who hadn't talked for 10 years, they are doing this after confessing to what they did, killing, burning houses, stealing property," says Korir, who has been a peace activist for 19 years and is director of the Tuna Uwezo project. "They spoke, and my God, they were moving stories."

Slowly, trust was built up, and the KYPD was formed. But tensions and temptations remain, and were visible during the meeting with Korir and Okanga.

Azulu Wazua, 39, is head of the KYPD. He tells Korir that landlords are threatening to evict people from the houses where they have been squatting since the last election, when Kikuyu tenants were driven from the area.

The squatters need somewhere to go. The KYPD members discuss options – should these people be given grants to set up small businesses and earn enough money to pay rent elsewhere, or should someone pay for new houses for them?

Global Communities does not offer money. The aim of the Tuna Uwezo project is to give communities the capacity to solve their own problems.

The men bring up the case of the fellow just arrested, and others who have been taken in by the police. But Korir is stern.

"I am not going to defend impunity. It is not going to be any responsibility of ours to get people out of custody if they have been arrested for a criminal act," she says. "Your past can come and haunt you."

Wazua then describes what he feels is the greatest threat to peace. "The main challenge is true reform [of gang members]," he says. "The youth are the main problem. They are energetic, they want instant life, and easily gotten things and they are undecided. They want to be on all sides."

The meeting draws to a close. Now, the talk is of organising a peace caravan and a sports tournament before the election. The aim, at least on the surface, is simple.

"All we need is to be very clear that our agenda is peace," says Korir.