The second time Ali Alavi visited Peaks Island, he came in the fall, in the off-season.

As he walked around the island, he didn’t see many people, and he began thinking of Peaks as the setting for his first novel, The Tombland’s Tale.

“It struck me as a place that is peaceful and would be perfect for someone who wanted to focus on writing a novel, or for a painter,” Alavi said.

His first trip to Peaks had been in the summer, and the island seemed a different place. In the fall, he felt a sense of remoteness, “the place looked desolate to me — that was sort of mysterious,” he said.

The quiet roads of Peaks Island are quite different from Tehran, Iran, with 12 million people, where Alavi grew up. Alavi learned English in Iran’s public schools. But he didn’t read a novel in English until he was 21. Now, at 33, he’s written his own book, The Tombland’s Tale, a novel of suspense set on Peaks Island, in Portland and New Hampshire.

In the novel a young business whiz, Christopher Wayne, becomes disillusioned with his corporate job and rents a cottage on Peaks to pursue his dreams of being a writer. He runs into an old high school friend, Rachel, who works at a Portland strip club. Wayne is drawn into solving a mystery involving kidnapped strippers. And the solution to the mystery is on Peaks Island as well.

Writing the novel is the fulfillment of a dream for Alavi, who left Tehran when he was 21 to study electrical engineering. He wanted to attend college in the United States, but thought that big cities such as New York or Chicago “would be too much, for someone just learning the language and culture,” Alavi said.

But he didn’t want to go to small-town America, either. With the help of his older sister, Marjan, who moved to Maryland in the 1970s, he picked Portland.

Alavi received a B.S. in electrical engineering, and then enrolled in the M.B.A. program at the University of Southern Maine’s School of Business. It was in a course taught by Associate Professor Rick Grover that he started thinking seriously about pursuing another career. Grover talked about Jungian analysis of personality types as a way of understanding leadership and organizational behavior. Alavi realized “I would be happier doing something else.”

But he earned a B.S. in business and finished his M.B.A. before seeking this new vocation. Alavi now teaches at Andover College in addition to writing.

As he returned several times to Peaks Island, Alavi realized his first impression of the island as desolate, with few residents, was wrong. But that initial feeling was the emotional inspiration for the story.

And the Peaks of his novel is quite different from real life. He drastically cut the island’s population. He created a huge estate on the island, originally owned by a wealthy Englishman, with a large mansion on the property.

He created an island in the bay that housed a prison. In the 1930s, a plague struck the prison, killing most of the inmates, who were buried on the giant estate on Peaks. That cemetery became known as the Tombland.

As an immigrant to Maine, Alavi is very happy in Portland. “The dominant culture is very liberal, very accepting and very welcoming to people who come from other places,” he said.

The Tombland’s Tale (269 pages, $12.95, self-published) is available in bookstores in the Greater Portland area.