The sheer amount of time devoted to Ireland was remarkable. It remained a priority throughout my time in Downing Street. In 1997, the ceasefire had been rudely shattered. Shortly after I took office, two policemen were brutally murdered. Even now, it is hard to look back on the events that led up to the Good Friday agreement, and the subsequent years, without a profound sense of amazement at how it all came together and how it was sustained. Alastair Campbell rightly says there was something mysterious, almost magical, about how things fell into place.

First, for those of us who in our youth flirted with the somewhat determinist branch of Marxist-oriented leftwing politics, the Northern Ireland peace process is a classic example of how individual people, in a certain place at a certain moment in time, can make the difference. With a different cast of individuals the outcome may well have been adverse. We were immensely fortunate to have an Irish leadership – in the form of Bertie Ahern and his key ministers – that was prepared to lay aside the grievances and attitudes of the past.

The same was true of the unionist leadership – at the beginning in the hands of David Trimble. It is easy to forget how simple and superficially alluring wallowing in the feeling of injustice or retribution for past hurt can be. The alternative requires the development of a wholly new narrative, the admission that the other side might have a point. So leaders have to speak of the possibility of reconciliation with those for whom history has been about the utter unacceptability of reconciliation. This is real political leadership, and it takes real character to do it.

Gerry Adams and Martin McGuinness of Sinn Féin had spent their entire lives fighting the British and unionism. They had made the speeches, led the protests, and been dismissed by many as terrorists pure and simple. Now they were speaking about how arms should be laid down for the hope of peace and the prospect of justice. These were not easy steps, and I believed in their sincerity.

When Ian Paisley finally pulled unionism over the line, with the current first minister Peter Robinson, he was obliged to put aside a career spanning half a century based on the notion that peace with republicans was impossible.

The moderates, like Seamus Mallon leading the SDLP, had to watch as the party that had always accused him and John Hume of a sell-out then cut the deal to govern with the ancient enemy. And of course we were all hugely lucky to have a US administration led by Bill Clinton and represented by George Mitchell, who were absolutely committed and matched that commitment with political skill of the highest order. All of this took extraordinary political sacrifice and personal risks.

Second, the personal relationships that are built during the course of making peace matter enormously. Again this is obvious, but frequently missed. Part of the problem in these situations – which I witness continually in my work in the Middle East today – is that to bring people together you have to understand in a genuine sense why they feel as strongly as they do. This is not a matter of reason but of emotion.

In a conflict there is suffering of a nature and on a scale that we from the outside can scarcely appreciate, because it is not within our experience. Each side has a sense of pain and of cruel consequence from the other side's actions. They need to know that those mediating get this feeling, not at a rational but at an empathetic level. In getting it, the mediator is then able to pass something of the pain of each side to the other. Especially where there has been violence over a prolonged period, and in conflict the violence often either falls or is even directed at the innocent, being able to articulate the sense of hurt and know that the other side has been forced at least to confront it, is a powerful way of opening up the dialogue that can lead to peace.

Many of the hundreds of hours I spent in discussion with the parties were not simply about specific blockages or details of the negotiation, but rather about absorbing and trying to comprehend why they felt as they did and communicating that feeling to the other side. In this way, they became my friends, because I then had inside me something of the passions they felt inside them. In addition, as the process wound its way, the parties got to know each other and started to look upon each other as human beings with a different perspective, not as enemies mired in evil and incapable of good.

We shouldn't exaggerate, because there was still enormous suspicion and resentment that at times threatened to sink the whole thing. But it was counterbalanced by human interaction, and that counterbalance was essential. Seeing Paisley and McGuinness work together, and attract headlines calling them the Chuckle Brothers, underlined how far we all came.

Third, people think of politicians making speeches, appearing in the media, engaging in intrigue and naturally taking the decisions that define their leadership. But I found that whatever the major issue being addressed, absolutely of the essence was the ability to frame a way forward in terms that were intellectually coherent.

At the heart of what we were doing in Northern Ireland was the idea that in exchange for just and fair treatment of the nationalist and republican communities, the resolution of the issue of United Ireland v United Kingdom would be left to the people of Northern Ireland.

Finally, giving the ordinary population the sense that they have a stake in the future, and that this stake is intimately connected with peace, is essential. In the end, a peace process is a curious symbiotic dance between leaders and led. The leaders have to give hope to the people that change can come. But ultimately, especially as the leaders come under pressure from within their own ranks, they need to feel the support of the people, willing them on, empowering them to compromise and move forward.

Never forget the people and never stop trusting them, when finally you put the deal before them, to call it right. They normally do. If politics is, in the final analysis, about changing the world for the better, this is a pretty good example of politics at work.

• This is an extract from the foreword to The Irish Diaries (1994-2003) by Alastair Campbell, published next week by The Lilliput Press

• Comments on this article will be opened in the morning