In researching the life of King David for her new book, Geraldine Brooks traveled to Israel, where she herded sheep on a Samarian hillside, stayed in a goat-hair tent and learned as much about Second Iron Age culture as she could. She consulted experts on food, warfare and music to help reconstruct the king’s story from beginning to end.

It was a different type of research, Ms. Brooks said in a conversation with the Gazette this week at her home in West Tisbury. In most cases, she said that journals, letters and other writings have informed her historical fiction and provided a voice for her characters.

“But obviously, when you go back 3,000 years, that’s not available to you,” she said.

The Secret Chord, to be released Oct. 6, chronicles the life of Israel’s second king, as told by one of his closest aides, the prophet Nathan. Ms. Brooks consulted ancient texts such as the Bible, the Talmud, and the Midrash to form the basis of the novel. But even taken together, those texts provided only glimpses of the past. Filling in the gaps meant retracing some of David’s steps, and relying more on the imagination.

Ms. Brooks doesn’t see herself as particularly religious, although she enjoys being part of the Martha’s Vineyard Hebrew Center. “I guess I’m interested in the questions. I don’t have any answers,” she said with a laugh.

At the Hebrew Center, Ms. Brooks would listen to the story of David on his deathbed, when his son Adonijah had declared himself king, and Nathan and David’s wife Bathsheba were conspiring to crown his other son Solomon instead.

“It’s so vivid, this scene of a once-great king who is kind of hanging onto life by his fingernails,” Ms. Brooks said. “I sort of walked backwards from there. And then I realized that you get to know him as a very young child.”

“It’s all very human,” she said of the story. “God doesn’t speak directly to David. He’s struggling like we all struggle, trying to make sense of his place, and failing to do the right thing.”

Despite the lack of personal detail (or perhaps because of it) the events of David’s life have inspired artists for millennia. David himself had a creative streak, playing the harp like no one else, and being credited with composing much of the Book of Psalms.

The title of the new book comes from the 1984 Leonard Cohen song Hallelujah. And Ms. Brooks counts Joseph Heller’s 1984 comic novel God Knows, about David on his deathbed, as among her favorites. (She didn’t think so highly of the 1985 film King David, starring Richard Gere.)

Striking in its intimacy, The Secret Chord sheds light on David’s childhood and his banishment to the hills of Bethlehem to tend the family flock — the result of a misunderstanding by which his father believed him to be the product of adultery. The tables turn when the prophet Samuel, advisor to King Saul, appears and secretly anoints him as the future king.

Ms. Brooks recasts well-known stories such as David’s battle with Goliath on a more human scale. In that one example, Goliath wasn’t the “hideous looming giant” of legend, according to David’s brother Shammah, who recounts the story to Nathan. And David himself, who was 14 at the time, “was scarcely a boy.” David’s act was celebrated, but just as striking was the stream of righteous invective he shouted while confronting the armed Philistine.

Later in life, having largely won the respect of his subjects, but now past his prime, David desires — with some prodding from Nathan — “To be known as a man.” He charges the prophet with setting down his life story, with all its flaws and failures.

Nathan was something of a gift in the writing process, said Ms. Brooks, who was intrigued by accounts of Nathan’s chronicling of David’s life. The Secret Chord imagines what that lost document might have said. But history had left few clues as to what David and his subjects were like, and how they spoke.

“They were pretty busy fighting and raising crops and herding, and they weren’t writing a lot down, as far as we know,” Ms. Brooks said of the early Israelites. “We had no idea how these guys sounded.” But she did prefer the “austere, blunt flavor” of the Torah over the newer King James Bible.

Originally, she envisioned “an Iron Age Mafia story,” with Nathan as a sort of crime boss consigliere. But that’s not how it played out. “He wanted to go in a completely different direction,” Ms. Brooks said. “And in the end, as a writer, you have to listen to your characters and let them emerge. You can’t force it if it’s not happening in the way that you intended. You’ve got to go where it goes.”

Both men are also shaped by warfare and gruesome battles, which Ms. Brooks describes in an unflinching voice.

“You can’t really write about the past without getting down into some of the horrors of it,” she said, adding that her years as a war correspondent in the Middle East provided some firsthand experience to draw from. “Battlefields don’t actually change that much, even though the weaponry might be more high tech,” she said. “The effect on human bodies is exactly the same.”

She recalled being jailed for three days while investigating a collaboration between the Shell Oil Company and the dictatorship of Sani Abacha in Nigeria. Aware of other journalists who had spent years in prison, she shifted her writing career away from journalism, returned home and had her first son, Nathaniel.

Her son Nathaniel took up the harp at a young age, sometimes evoking images of a young David. He also played football at Martha’s Vineyard Regional High School, where he graduated last year. “He developed these big, muscly arms and hands,” Ms. Brooks said, explaining the genesis of the novel. “And when he was playing the harp he could get a very big sound out of it that you don’t usually associate with harp playing. And I thought, well, David would have done that too.”

While writing The Secret Chord, Ms. Brooks kept a small sculpture of a harpist that belonged to her son — it was a replica of an artifact uncovered in Israel — on her windowsill.

The Biblical Nathan’s history of David’s life may only exist in the imagination, but Ms. Brooks doesn’t dismiss the possibility that it might still turn up. “Wouldn’t that be cool?” she said with a smile. “It could be in a clay vessel somewhere in a dry cave that we haven’t found yet. I love thinking about that.”

The Secret Chord, published by Viking, will be available Oct. 6. Geraldine Brooks will speak about the book at 5 p.m. on Oct. 18, at the Martha’s Vineyard Hebrew Center.