If someone tells you they have an idea for a book, says Sebastian Barry, advise them to “go home and drink for a few months, and then come back and have no ideas. Because you don’t have ideas for books.” Indeed, if one does happen to occur, then sadly, “that’s the end of that book. You have ideas for books when you finish them.” This is very much the counterintuitive, back-to-front and frankly confounding sort of thing Barry says when he’s talking about writing. I point out to him that during the course of our conversation about A Thousand Moons, his eighth work of long-form fiction and a continuation of the Costa-winning Days Without End, he has equated the process of creating a novel to being a train robber on the run; to elaborating Einstein’s theories of time; and to ensuring the safe return of Buzz Aldrin and his crew from the moon, in a scenario in which the novelist is at once ground control at Cape Canaveral and “also the fucking rocket”. I mean, what’s going on here?

He pauses for a moment. “There may be a dog in the rocket too,” he adds, almost apologetically. “It may have snuck on.”

But if this sounds like a kind of parody of haute literary pretension, I should point out that much of the time Barry is laughing, although he sometimes seems close to tears, and that I occasionally suspect him of teasing me. In fact, the two conversations we have – one in the old rectory in the Wicklow mountains that he shares with his wife, actor and screenwriter Alison Deegan, and several dogs ranging from the tiny to the enormous, and the other in the offices of his London publisher – are notable because of their swift gear changes from the silly to the serious, the light-hearted to the sad and strange.

The story behind all his novels – beginning with The Whereabouts of Eneas McNulty in 1998 and including Annie Dunne, the Booker-shortlisted A Long Long Way and The Secret Scripture – is one of the deliberate and careful construction of a family that would at some level stand “in place of the kind of disaster of the family I was accidentally part of originally. I mean utter disaster.” What was so disastrous about his family? “I don’t see my father. My brother has disappeared. My sister, whom I adore, lives in France. My mother was a complicated bipolar person, absolutely glorious in some ways, absolutely ... I mean, to be a child of those people.”

In the theatre, every word, every sentence, every moment, has to be full of electricity; it has to be plugged in

His brother, he adds, was “a verifiable genius”, who as a young man was inundated with scholarship offers to study astrophysics in the US, and whom Barry doted on in a way that he describes as “fatherly, without the responsibility of being a father”. Later, he developed mental health issues, and Barry isn’t sure exactly where he is. About this relationship, and those with his parents, he is clear and adamant: “Some people may be more practical than me about this. But these are losses, as far as I’m concerned. All these battles were lost.”

In the early 1990s, Barry and his wife had twins, who are now 27, and he felt what he terms “a sense of emergency”: “I realised I had to make some reckoning with all of that. And you know, you’ve got to call a loss a loss. It is very like accountancy.” He remembers wanting to create a family history for his children, even if they never made use of it, because it would be preferable to “the rather frightening thing I knew”.

Creating – often idealising – a family tree is not uncommon. But Barry’s endeavour turned out not to be one of sanitisation; rather, he notes: “I had a suspicion that it would be among the outlaws that I would find worthy family members.” His characters frequently find themselves at the interstices of history, propelled by forces unknown to them. Violence is commonplace; separation, loss and madness far from unusual.

Each of the novels imagines and expands on the history of one of Barry’s ancestors, about whom he often knew only the sketchiest of details. “I didn’t know anything about the woman who became Roseanne McNulty in Secret Scripture,” he recounts. “All I knew was that she was in my great-uncle’s band, and that she was sectioned for some reason. And she lived the rest of her life in an institution, and he married again. I did meet Lily from On Canaan’s Side once. She was just back for a few days from America. But I didn’t know anything about her life story. I knew one great-uncle had been murdered in Chicago. I didn’t know anything about my great-uncle in the first world war. Apparently, I had three of them.” They became one fictional character, Willie Dunne, from A Long Long Way.

Another forefather, Thomas McNulty, left Ireland during the famine and found himself fighting in both the Indian wars and the American civil war. It was a story that Barry’s grandfather told him as he lay in bed as a child, he says: “It means one thing when you’re six. But it means a whole different thing when you’re 60.”

Facebook Twitter Pinterest Rooney Mara and Jack Reynor in the 2016 film adaptation of The Secret Scripture . Photograph: Allstar Picture Library/Alamy Stock Photo

In Days Without End, Barry introduced readers to Thomas, a teenager whose “entire history as a human being has been removed from him”. His family lost to the famine and his homeland ravaged, Thomas makes for the US, whereupon he finds himself enlisted in the American army, and falls in love with another soldier, John Cole. When the novel was published, Barry spoke movingly about how it was inspired by and dedicated to his younger son, Toby, who – after a period of what his parents feared was depression but transpired to have more to do with the pressure of secrecy – had told them that he was gay. The novel was, said Barry at the time, a celebration of his son, and an insistence on sexual and emotional freedom.

But the book was not without its darkness. Thomas and John take in a young Lakota Native American woman, Winona, whom they love as their own child; they have also been “fully complicit in the murder of her people and her family; the thing is utterly disgraceful and infinitely questionable”.

In A Thousand Moons, Barry gives Winona her own voice and her own story. The novel is an attempt to allow her to reckon with the violence both past and present that is done to her, her relationship with her adoptive fathers, and the development of her own sexuality.

Barry is in the UK ahead of the publication of A Thousand Moons but also because On Blueberry Hill, his prison-cell play, is about to open in the West End of London. In 2017, Barry, the Irish theatre company Fishamble and the play’s cast, Niall Buggy and David Ganly, performed the piece in Mountjoy prison, Dublin; Barry describes the experience of hearing prisoners cheer the actors on as being close to how he imagined Elizabethan theatre. When he reads from his prose fiction, he is strikingly performative, but novels are, of course, different from drama. How do the two work together for him?

Facebook Twitter Pinterest Niall Buggy, left, and David Ganly in On Blueberry Hill. Photograph: Patrick Redmond

“In the theatre, every word, every sentence, every moment, has to be full of electricity; it has to be all plugged in. You can’t have anything that doesn’t echo or reverberate.” He has tried to bring the same “spontaneity” to the business of writing novels; the paradox is that it requires a great deal of patience. “For a year you can read and console yourself that you’re doing some work. But then you have this year of waiting. I waited for all those books – and waiting is very frightening and humiliating.”

When I ask Barry how he approached the task of writing from the point of view of a young Native American woman – and especially the extent to which he worried about issues of cultural appropriation – he talks to me about his friendship with the late writer and activist Peter Matthiessen, whom he used as a model for the character Dillinger in On Canaan’s Side. Matthiessen had immersed himself in the lives and civil rights battles of the indigenous people of Dakota; following the publication of Matthiessen’s book In the Spirit of Crazy Horse, the governor of South Dakota and an FBI agent involved in a notorious shootout had attempted to sue his publishers for millions of dollars, disputing his versions of events.

Barry recalls Matthiessen saying to him – in words that he then transferred to the fictional Dillinger – that the most important thing we’ve been told about in our lifetime is DNA. “Because the good news is, we’re all the same family. And the bad news is, we’re all the same family. I not only fervently believe that, but I hold on to that, with every grappling hook in my possession.”

“As soon as you construct, either for positive or negative reasons, divisions among us, then you give rise to a history like Ireland’s history of religious wars. You give rise to my grandfather’s hatred of England; he didn’t even want me to come here. ‘Is your own country not good enough for you? We fought 1916 for you … ’ All these allegiances have a wonderful side to them, a sort of gold side, but they also have this dreadful, tarnished toxic underbelly. Those ideas that are only made more murderous by insisting on the differences between us.”

Winona and Thomas are, he argues, correlatives of one another; their experiences of violence and dispossession relate to one another. But they are also crucially different; although both the Native American and Irish populations have risen to roughly similar levels after huge depletion, the Irish have always been in the majority in their own land. “I’m highly aware of the refuge that America was for Irish people – although we were called lice and scum when we came during the famine – and for Jewish people fleeing the Shoah, for black people who were dragged there from west Africa. I understand all that.” But the phrase that has been echoing in his mind with reference to the land taken from the American Indians, especially since Trump rose to power is, “Give it back.”

He brightens a little, as he thinks of the determination of those who made long journeys to safe ground, to new horizons. “I mean, we’ve got to itemise the glories of mankind,” he says, “because there’s been plenty of the other thing. You can make a fucking long list.”

• A Thousand Moons by Sebastian Barry is published by Faber (£18.99). To order a copy go to guardianbookshop.com. Free UK p&p on all online orders over £15.

• On Blueberry Hill runs at Trafalgar Studios from 5 March until 2 May. For tickets visit www.onblueberryhill.co.uk