Rona Munro was a little girl when she first fell in love with history.

All those tales of kings and queens in castles besieged by invading armies fired her imagination. Later, on summer holidays in Scotland, the litte girl would let that imagination run wild.

"I would be running round all these castles pretending I lived there," the Aberdeen-born playwright says on the eve of the Edinburgh International Festival's world premiere of The James Plays, her epic trilogy of Scottish history plays. "That's just what this has been like, being able to play like that."

The James Plays is a cross-border co-production between EIF, the National Theatre of Scotland and the National Theatre of Great Britain that charts the lives and loves of James I, James II and James III, who ruled Scotland in turn during the 15th century. In the first play, subtitled The Key Will Keep The Lock, James I attempts to rule after spending 18 years in an English prison. James II: Day of The Innocents is seen through the eyes of the boy who was crowned king aged just eight years old. Finally, James III: The True Mirror focuses on the feckless aesthete whose reign becomes a grand folly only saved by his wife, Queen Margaret of Denmark.

"I'm a bit passionate about Scottish history," says Munro, who studied the subject at the University of Edinburgh, "and this is the period I love the best. There's this glamorous Game of Thrones thing going on, with everyone going round wielding swords, and people's lives becoming more epic, but there's not much known about the period, particularly in Scottish culture."

As with the contemporary language used in the plasy, Munro cuts through the political and inter-personal complexities of such a rich tapestry to keep things alive for a modern audience.

"James I is very much about a man who wants to be a statesman, and a moral one at that," she explains. "James II is a child's nightmare of what it's like to be king, and James III is about a man who doesn't really want to be king at all."

While much of her work on stage and screen has been grittily contemporary, The James Plays isn't the first time Munro has looked to history for inspiration. Her last play for EIF, The Last Witch, seen in 2009, looked at the case of Janet Horne, the last woman to be executed for witchcraft in Scotland. As with that play, the women in The James Plays are key to how things pan out.

"We know an awful lot less about the queens," says Munro, "so it's a case of chicken and egg. Do we know less because they did less, or is it because there was less written about them because there was less interest in them?"

"We can be fairly confident that James I really was crazy about Joan.

"In the second play, at the point James II married Mary, he stopped being a puppet and started to be his own king. I like to think Mary provided the strength and support he needed to do that.

"Queen Margaret is an accepted enough part of the Scottish scene, but there are still things we don't know, so the plays are definitely about the women as much as the men."

One woman in particular may well steal the show. The casting of Sofie Gabrol, the star of Danish TV thriller The Killing as Queen Margaret, has thrown an even bigger spotlight on the James Plays than it already had. Not least, it seems, in the rehearsal room.

"Oh my God," says Munro, sounding every inch the fan-girl. "Every time I look at Sofie I have to do a double-take. When she came in we'd already been working on the plays for eight weeks, and everyone was going slightly stir-crazy, so we all had to try and keep it together and not get star-struck."

Star-struck or not, Munro is relishing the opportunity to see the cast get stuck into such meaty material.

"When I was a kid," she says, "and all the boys were playing sword-fighting games on the street I used to want to join in, but was told I couldn't because I was a girl. Now on The James Plays we've got these two fight directors working on all these battle scenes, and finally it feels like I can. We're big kids playing these games, only now we've got to make them look real."

James I: The Key Will Keep The Lock, James II: Day of The Innocents and James III: The True Mirror, Festival Theatre, Edinburgh; all three plays can be seen on the same day on Aug 10, 16, 17 and 20 at noon, 4pm and 8.15pm; James I: The Key Will Keep The Lock (only), Aug 5 (preview), 12 and 19, 7.30pm; James II: Day of The Innocents (only), Aug 7 (preview), 13 and 21, 7.30pm; James III: The True Mirror (only), Aug 9 (preview), 14, 15 and 22, 7.30pm.

www.eif.co.uk