When David Greig woke up to a newspaper interview he'd done about his latest play, what he read bore little resemblance to the work he was still in the process of writing.

The Events, according to the report, was to be a musical about the Norwegian killer Anders Brevik, who slaughtered 77 people in July 2011 when he bombed central Oslo before opening fire on an island youth camp. Brevik claimed the attacks were to prevent what he saw as the Islamisation of Norway, and is serving a 21-year prison sentence for terrorism and premeditated murder.

To suggest that such a serious writer as Greig would do anything so crass as pen a musical about such a horrific occurrence, then, was as misleading as it was inaccurate. The Events, which runs at the Traverse Theatre in Edinburgh as part of its Edinburgh Festival Fringe programme, may or may not draw inspiration from massacres such as Brevik's, but it looks set to be a far subtler experience than previous reports suggest.

"My first reaction was anger," Greig admits. "To suggest that I was writing a musical about Anders Brevik was so far away from what we were doing. Then my second reaction was that the subject was so controversial, that maybe some things are too dark to talk about."

The Events focuses on a liberal-minded woman and how she reacts when the choir that she leads are attacked, with tragic results. "She's a typical liberal," says Greig. "She's vegetarian, a little bit hippyish, she works with depressed people, and she runs this choir. She thinks she can find empathy with the attackers, but she's also the victim."

The Events began over a conversation with Ramin Gray, pictured, below, artistic director of Actors Touring Company (ATC), who are lead producers of the show, in the Traverse bar.

"We realised there were similarities between the Islamic terrorists who were involved in 9/11 and 7/7, and Brevick, who had not long before been responsible for this great tragedy in Norway," Greig continues. "As we've also seen more recently with events in Woolwich, which again isn't dissimilar to Brevick or 7/7, these things were all committed by strange, vacant-eyed boys. They're sort of bogeymen, but they're weak, inadequate bogeymen."

"All of the things mentioned have a political context," Gray observes. "They're not like what happened with the equally terrible events in Dunblane or Columbine. They have a political purpose, however warped they might be. Maybe the people behind them were abandoned or abused, we don't know. When these things happen, all of us, whether they affect us directly or not, spend days and weeks trying to work out what happened and why it happened. We also try to work out what should happen to the perpetrators. I think part of the reason these people obsess us is that there's no clear answer ever."

The Events is a co-production between ATC, the Young Vic, Brageteatret in Norway and the Schauspielhaus in Vienna. After its Edinburgh run, the production will play in London, Dublin and Birmingham. The pair's research– which involved speaking to psychiatrists, hypnotherapists, priests and many others – took them to Norway, where they spoke to a boy who was on the island when Brevik opened fire.

"I haven't spoken to any perpetrators," says Greig. "That's probably a mistake."

This may be so, though both Greig and Gray are at pains to stress that The Events is very much a work of fiction. "Our project is to investigate and probe," Gray explains. "To understand is maybe to condone, and maybe that's not possible."

Greig wonders whether "understanding would give the perpetrators some kind of victory. The play ends in an act of retribution, but it's all a bit ambiguous at the moment, and we were just discussing whether any of us would kill the perpetrators of such a crime. Some would, some definitely wouldn't, but what I think the play does look at is that this idea of understanding is kind of a shroud that's put in front of you to avoid the darkness, when actually you need to face the darkness."

Greig wrote The Events while his stage version of Roald Dahl's Charlie And The Chocolate Factory, playing in London's West End, was being rehearsed. The image he presents of him sitting at the back of the Theatre Royal in Drury Lane writing something so recognisably serious as The Events while something so fantastical as Dahl's story was being knocked into shape is a glorious counterpoint to the material.

One crucial element of The Events will be the onstage appearance of a real choir, which will be made up of local singers from each town or district the play tours to. "The choir came first, in a way," says Greig. "We saw a choir when we were in Norway, and it seemed like such a perfect image of the best in being human. In the play, what happens to them becomes the motor for the story. A choir is a group that can include or exclude you."

Gray points out that "The play looks at the effect of these events on the community and communities in general. Every community is bound to every part of humanity, and a community choir really taps into that. It's a simple way of making the play sing."

As the play is presented in different places, particularly in towns or cities still raw from real-life tragedies, one can't help but wonder how audiences will react. Norwegian audiences in particular may perhaps recognise some aspects of themselves onstage. "What I would very much like," says Greig, "is for people in Norway to be able to reflect on it, and to bring their own experience to it in a creative and positive way."

Gray concurs. "What I would like to do," he adds, "is to provide a space for a community to come together and share a moment."

"What I'm not interested in," insists Greig, "is going out to shock or provoke. That would be horrible."

The Events, Traverse Theatre, Edinburgh, July 31-August 25

www.traverse.co.uk