The first I knew about the attack on Parliament was when my phone buzzed with a text from my husband: "Where are you? Are you ok?"

Parliament is a grand old building with very thick walls and sitting where I was, in a House of Commons committee room, I had no idea of the tragic events that had unfolded outside. Quickly, though, the very able men and women of the security services took charge and we were calmly moved to a safer part of the building.

Over the course of the next five hours, spent in the company of a couple of thousand others who had happened to be in the House that day – parliamentarians, staff, lobbyists, constituents, school children on tours – I had plenty of time to think about my reaction to the experience.

It was frightening, of course. Violence always is. And incredibly sad. Sad for the innocent men and women who lost their lives, including the incredibly brave PC Keith Palmer who died trying to stop the attacker. My heart goes out to their family and friends.

I also felt enormous pride – in PC Palmer, in Tobias Elwood MP who ran towards the injured man rather than away, and in our incredible police and ambulance men and women, and all the MPs, staff, Londoners, visitors old and young, who waited calmly as we were moved to safety, first inside Parliament and then into the beautiful and serene Westminster Abbey.

No one complained, no one panicked, and no one (at least in my hearing) leapt to conclusions about the attacker or called for walls or travel bans. Instead we kept an eye out for each other and chatted, as the wonderful staff handed out tea and biscuits. It was a very British crisis.

But in my case I also felt no small sense of irony. I was in Parliament Wednesday to speak at an event about the enormous suffering that continues today in Iraq and Syria. My topic? How can we not only help those whose lives have been riven by violence, but get at those driving forces – inequality, injustice, corruption, marginalization – that leave people vulnerable to recruitment to violent ideologies.

This is not in any way to excuse violence. The attack perpetrated on Wednesday was horrific, cowardly and criminal – as are all such acts. However in the places Mercy Corps works (including Somalia, Northern Nigeria, Syria, Iraq) we have seen time and again that people do not start out violent, and many have no wish to participate in any way with extremist groups. But a deadly cocktail of inequality, injustice, experience of violence and loss of other options leaves them ripe for the picking by those who would draw them into their violent agenda.

One of the strongest predictors of participation in violence, is experience of violence

In some of the 40 countries we work in, Mercy Corps has conducted a number of studies over the last five years to build our understanding of why young people participate in violence. We have interviewed Jordanian fighters returning from Syria, young men and women in northeast Nigeria – some who have joined Boko Haram, some who have resisted – young people in Iraq, Afghanistan, Colombia, Somalia – all to understand why they may or may not be vulnerable to recruitment.

And what we have found surprised me. It turns out there is no one profile of who resorts to violent extremism. They come from diverse backgrounds, employment status, types of education. Some are very high achievers, some not. Some are very politically engaged, others not. Many former fighters we've interviewed have told us they were not especially religious before joining a violent extremist organisation.

However, one of the strongest predictors of participation in violence, is experience of violence. This is particularly true when it is state perpetrated violence. Overall political violence in all its forms is driven by experience of injustice – real or perceived – and by frustration and disempowerment.

London terror attack Khalid Masood adrian ajao
London terror attacker Khalid Masood, who was known as Adrian Ajao when at Huntley's Secondary School in Tunbridge Wells in 1980

That does not mean we should ever excuse or condone violence – but nor should we feel helpless in the face of it. This knowledge gives us a pathway to do something to reduce the power of violent extremists to recruit.

We can do this by working with young people who have experienced violence and injustice, by helping them to have a say in their own futures, to make good choices, by promoting positive relationships between states and citizens. We can do this be seeing young people as a huge resource with enormous potential, not a threat.

Mercy Corps does exactly this. Corruption and government negligence drive grievances that lead to support for Boko Haram in Nigeria, so we work with the government to increase young peoples' inclusion in decision-making processes, we work with businesses to improve job opportunities and financial access.

In Jordan, we support Jordanian and Syrian families to talk with their children about the dangers of these groups so they are less likely to be susceptible to recruitment. In Somalia, we provide young people avenues to create change in their communities through peaceful means. We help young people recover from crisis, and build positive futures.

Wednesday was a terrible day. But perhaps good can come of it, if it gives us a renewed sense of empathy for all those in the world that suffer the effects of violence, and if it inspires us to help young men and women resist taking any part in it.

Selena Victor is Director of Policy and Advocacy at Mercy Corps, a leading global organisation working in over 40 countries.