LEWISTON — Maria Padian was in the audience 10 years ago when thousands of people gathered to support Somali families and to denounce the white supremacist group that had gathered across town.

The Brunswick writer and mother of two watched in wonder as person after person took to the Bates College stage to speak about tolerance and diversity. Some were teenagers.

"There had been so much negative press, so much fear about what was going to happen, and I think all of us were looking at each other in a state of absolute disbelief over all of the positive energy that was exhibited that day," Padian said recently.

Ten years later, a similar scene ends Padian's new young adult novel, "Out of Nowhere."

The book tells the story of Tom Bouchard, a Franco-American high-schooler whose life is turned upside down when his hometown becomes the settling point for a large group of Somali immigrants.

The story takes place in the fictional city of Enniston, Maine, but it's inspired by Lewiston all the way.

"When I was at that rally, never in a million years did I think that I would be writing about this," Padian said.

Padian, 51, worked as a journalist and press secretary before penning her first book, a young adult novel titled "Brett McCarthy: Work in Progress." The book, published in 2008 by Knopf Books for Young Readers, won a Maine Literary Award and the Maine Lupine Honor Award. Her second book for teens, "Jersey Tomatoes are the Best," was published by Knopf in 2011.

Both deal with the lives and friendships of teenage girls.

Her latest book is also written for teenagers but tackles a different topic. "Out of Nowhere" centers on the friendship between two teenage boys — one Franco-American and one Somali — after a wave of immigrants move into an unprepared Maine city.

Once secure in his world, Tom Bouchard suddenly finds himself struggling to understand classmates and soccer teammates who practice a different religion, speak a different language and come from a war-ravaged country he can't even imagine. At the same time, family members, coaches and community leaders, including the city's mayor, all have different reactions to the newcomers.

Padian, who's lived in Brunswick for more than 20 years, was inspired by the real-life situation in Lewiston. In 2001, Somali immigrants began moving into the largely white, largely Catholic community. Some in Lewiston celebrated the diversity. Others resented the strangers.

The city's schools, which threw together native Lewiston children and Somali children, became the proving ground.

"I had children playing sports," Padian said, "and I would see these Somali kids playing sports and integrating into the community. The question I had was, 'Wow, what was it like for them?"

However, Padian didn't feel able to write from the point of view of a Somali teenager, whose refugee camp experience, customs and religion were so different from what she knew. So she told the story instead from the view of a white, Catholic teen.

Padian based many of the book's key plot points on events in Lewiston, including a controversial letter written by the city's mayor, who told the Somali community that the city couldn't handle any more immigrants and asked Somali elders to slow the migration. In real life, as well as in fiction, the letter proved to be incendiary, drawing national attention and leading a white supremacist group — The World Church of the Creator in real life; The United Church of the World in fiction — to hold a rally in the city. That led to a counter rally attended by thousands who wanted to show their support for the Somali community.

But while many of the book's locations, descriptions and events are based on Lewiston, Padian is quick to point out that some events in the book are purely fictional, including a rival soccer team that raises questions about the legal age of a star Somali player. And all of the characters, she said, are fictional.

"Even though I've interviewed and gotten to know young people in Lewiston, I've said to them, 'I don't want you to look at this character and think I was trying to re-create you. You were an inspiration for this, but the people in this book, I made them up.' I made them up. So I think that's really important," she said.

Padian spent two years interviewing teenagers and adults in Lewiston and Portland for the book.

"They were incredibly generous and incredibly open with me and they inspired me," she said. "What was hard about writing this book was that I wanted so badly to do them justice, and I wanted to be as true to their story as I could. I hope that I've achieved that."

It seems that she has. Although the book won't be released until Feb. 12, advance copies are circulating and Padian has gotten positive feedback from the people she's interviewed. And, "Out of Nowhere" has been chosen as one of the books to be featured in a citywide reading program in Portland.

Despite that good news, Padian is still anxious about the book's release next month.

"I've been nervous," she said. "I've been nervous about the book coming out because, God, I'm writing about something right in my backyard."

But no matter what, she felt "Out of Nowhere," and Lewiston, had an important story to tell.