AUBURN, Ala. — He ended up as the eulogist at Harper Lee’s funeral last year, but the Alabama historian and author Wayne Flynt did not exactly get along with the novelist when they first met in 1983 in the small lake town of Eufaula, Ala.

He asked her to sign his copy of “To Kill a Mockingbird.”

“She said, ‘No, I only sign for children,’” Mr. Flynt said, laughing, in an interview here. “I thought, you are really discourteous. Essentially, you’re just like all the stuff I’ve read about you.”

But over the next 25 years, Mr. Flynt, 76, a professor emeritus of history at Auburn University, said he became close with the famously reclusive Ms. Lee, who would have turned 91 on Friday. His new book, “Mockingbird Songs: My Friendship With Harper Lee,” is based on their relationship, on his takeaways from visits to the nursing home where she lived in her last years and from letters she sent that give a full sense of a personality that was one of the great literary enigmas of the last half-century.

In one, from March 2006, she declared Truman Capote — her childhood friend and literary rival — a liar.

“I don’t know if you understood this about him,” she wrote, “but his compulsive lying was like this: if you said, ‘Did you know JFK was shot?’ He’d easily answer, ‘Yes, I was driving the car he was riding in.’”

Ms. Lee wrote that Mr. Capote’s drinking and misery soured their friendship. Jealousy ended it.

“I was his oldest friend, and I did something Truman could not forgive: I wrote a novel that sold,” she wrote. “He nursed his envy for more than 20 years.”

The book, due out May 2, provides a rare glimpse behind the curtain that Ms. Lee drew around herself after the sudden success of “To Kill a Mockingbird” propelled her onto the public stage. The novel about racial injustice in the 1930s has sold more than 40 million copies, won the Pulitzer Prize in 1961 and created a firestorm of interest about her that ultimately drove Ms. Lee to retire from public life.

She stopped giving interviews in the 1960s and told Mr. Flynt that she typically vomited before speaking engagements — so much so that she came up with a little pep talk, “a mantra of great egotism,” to help alleviate the pressure.

It went, according to a letter from 2006: “I’m older than anybody here, I know more than anybody here, so why should I be so afraid of anybody here?”

“It works for about 15 minutes,” she confided.

Mr. Flynt and his wife, Dartie, were among the few people who remained part of Ms. Lee’s inner circle as it shrank in the years preceding her death at 89 — their friendship born, Mr. Flynt said, from similar senses of humor and a shared love for Alabama history.

Ms. Lee told Mr. Flynt she did not want him to write about her while she was alive. But she said nothing, he said, about his writing about her after she died.

“This allows her to speak beyond the grave and without any risk to her privacy,” he said.

At least two other books about Ms. Lee are planned in coming years. The New Yorker magazine writer Casey Cep will explore Ms. Lee’s unfinished crime novel in a book for Alfred A. Knopf next year. Ms. Lee’s family is also searching for a biographer because relatives say they are displeased with Charles J. Shields’s 2006 unauthorized book about her. That makes for at least six books from major publishers about a woman who wrote only two.

The Shields biography, “Mockingbird: A Portrait of Harper Lee,” a best seller, was well received. Garrison Keillor, in his Times review, described Mr. Shields as “a scrupulous journalist who respects the lady’s privacy even as he opens up her life.”

Ms. Lee was not so taken with it.

In one letter, dated March 28, 2006, she said the book traveled the path from “fiction to nonsense,” and she labeled Mr. Shields a “creep.”

“I know she herself hated it,” said Claudia Durst Johnson, an author, scholar and friend of Ms. Lee’s. “She thought it was poorly written.”

Mr. Shields has said that he believes Harper Lee and her sister Alice were particularly upset by a description of their mother, Frances Finch Lee, as manic depressive.

Hank Conner, the sisters’ nephew, said, “I think he said some things about my grandmother that weren’t true.”

Mr. Shields has said he tried to be discreet in mentioning Frances Finch Lee’s mental health, but said he felt it needed to be addressed.

Ms. Lee was a prolific letter writer. Her writings to Mr. Flynt often ran a dozen pages in a slanted, if sloppy, cursive. In them, her love for Manhattan is apparent. She kept an apartment there from 1949 until she suffered a stroke in 2007 that sent her home to Alabama. New York was a refuge for Ms. Lee, who liked to attend Mets games, Broadway shows and the Metropolitan Museum of Art. If she died in New York, she wrote, she wanted her ashes scattered above Manhattan “without ceremony.”

Ms. Lee’s letters are peppered with self-deprecating jokes about the macular degeneration that in recent years had damaged her eyesight — “Blind is now a no-no word, like sin” — and about her bout with fame. It wasn’t just the klieg lights of celebrity that worried her, but the darker impulses sometimes provoked by stardom. She described, Mr. Flynt said, one close encounter with a stalker who followed her from Birmingham to her home in Monroeville. That only cemented her fear for her safety, he said.

“She was obsessed with the idea of stalkers and assassination,” Mr. Flynt said. “She was really afraid of being killed for the sake of someone else’s neuroses.”

Though she kept the public at a distance, Mr. Flynt said Ms. Lee was loyal to friends and family, caring for her brother; father; and literary agent, Maurice Crain, at the end of their lives. “She was incredibly empathetic, and that’s a part of her life people don’t understand,” Mr. Flynt said.

Ms. Lee praised her sister Alice, who died in 2014, as “the most remarkable person I ever knew.”

“She keeps me out of the federal pen,” she wrote.

Mr. Flynt described Ms. Lee as a Christian realist who was not sentimental about religion and enjoyed reading the apologist C.S. Lewis. A book of his complete works lay on her ottoman when she died, Mr. Flynt said.

In her letters, Ms. Lee often mentioned books and writers. She praised a host of authors, from Frank McCourt to William Faulkner. She referred to Eudora Welty as “my goddess.”

As for her own work, Ms. Lee said she was content with “Mockingbird,” though, despite its popularity, she saw its shortcomings.

“I wonder what their reaction would have been if TKAM had been complex, sour, unsentimental, racially unpaternalistic because Atticus was a bastard,” she wrote to Mr. Flynt on July 31, 2006.

He didn’t know it then, but she actually had written such a book. It was called “Go Set a Watchman,” and it depicted Atticus as a racist, not a hero, and it had been a first draft that was ultimately rewritten and became “Mockingbird.”

“Watchman” resurfaced and was published in 2015 amid concerns that Ms. Lee, old and infirm, may not have fully participated in the decision to publish a long forgotten and flawed first novel (which has now sold more than three million copies, according to HarperCollins). But Mr. Flynt was adamant at the time that she had welcomed the publication.

Now, looking back, Ms. Lee’s 2006 letter to him gives us some sense of just why.