Back in 2005, Adam Rapp visited a town that banned one of his books – and turned the experience into The Metal Children, a play that is running in front of sold-out audiences at the Vineyard Theatre in New York City through June 13.

Rapp’s actual banned book, The Buffalo Tree, bears no resemblance to The Metal Children, the fictional novel within the play. In The Metal Children, a group of pregnant teenagers mysteriously disappear, one by one. After each girl vanishes, a metal statue of her appears on a barren cornfield. Ultimately, the heroine kills herself and her fetus with her dad’s knife.

In Rapp’s play about this made-up novel, officials lock up school copies of the book, which is inspiring local girls to get pregnant. Author Tobin Falmouth (portrayed by the actor Billy Crudup) visits the middle-American town of Midlothia, impregnates Vera (the 16-year-old leader of a get-pregnant movement inspired by The Metal Children), and speaks to townspeople at a meeting about his banned book. Vera passionately defends it. Roberta Crupp, an opponent, asks, “Is it necessary to bring the grisly subjects of abortion, teen pregnancy, and sorcery into the classroom?” Meanwhile, a boy stabs Tobin in the stomach with a hunting knife.

It’s pure fiction. Rapp, now 41, wrote “The Metal Children” in 2006 and performed workshops with it at the Vineyard Theatre in 2008 – before news broke that teenagers in Gloucester, Mass., were getting pregnant en masse. “It’s totally coincidental,” said Rapp.

He came up with the idea for a play about a book banning after he visited Reading, Pa., where high school officials confiscated copies of The Buffalo Tree. The Buffalo Tree – loosely based on his fifth-grade experience in a reform school for fighting, vandalizing, and stealing hood ornaments – contains foul language, implied masturbation, and a boy getting an erection in the shower.

What’s similar between The Buffalo Tree and The Metal Children is not the plot but the reactions the books generated in two small towns that found them offensive.

In the spring of 2005, Rapp got a call from New York Times writer Bruce Weber, who told him townspeople were meeting to talk about the improper banning procedure. Was Rapp going? No. He was starting rehearsals at Steppenwolf Theater in Chicago for the world premiere of Red Light Winter (which became a Pulitzer Prize finalist). A year later, the community called another meeting, and this time, Rapp attended.

The meeting moved and inspired him. “There was something about going to a community and looking people in the eye who had read my book,” Rapp said. “It did make me consider the moral implications of what I’m doing more.” He added that doesn’t want to change how he tries “to tell the truth about tough subject matter. But it’s definitely affected me in the way I think books are very personal and possibly life-changing things.”

And so he wrote The Metal Children, which he also directs. “A lot of the play is extrapolated fantasy,” said Rapp. “I don’t mean fantasy like sexual fantasy, but going down a rabbit hole.”

Unlike Tobin Falmouth, Rapp has never been married. (He lives with the actress Katherine Waterson.) “I was never stabbed. I never slept with a 16-year-old girl!” he said. “No one was throwing ham at me. No one was graffiti-ing my motel room.” And he didn’t hang out and drink with the English teacher who was his biggest defender. “I don’t think I’m as interesting as Tobin is,” said Rapp. “I felt like making it up and creating more extreme variables would be a lot more interesting than creating a piece of documentary.”

Rapp respected the townspeople who protested against his book and felt they cared deeply about how it would affect teen readers. In The Metal Children, he wanted to convey that objectors were thoughtful, he said. “It’s really important that they’re balanced, and that they’re people with real concerns.”

Doug Aibel, the artistic director of the Vineyard Theatre, noted Rapp’s focus on making sure the play shows both sides. “The residents in the town who have strong convictions about the book are not treated in a cartoon-ish way,” he said.

Rapp worried about whether The Metal Children would offend anyone in the YA world. Elizabeth Law (now publisher of Egmont USA), who edited his first novel, Something the Piano, reassured him. “She felt I was actually bringing great attention to it to show how profoundly a YA book can affect the community,” he said.

The prolific Rapp has written seven YA novels – along with 14 plays, one adult novel, a graphic novel and two feature films. “I love writing about teenagers,” he said. “It’s my favorite period of life to write about. It’s chock-full of people having to make choices. You have so much intense stuff going on. It brings out some of the greatest storytelling.”

But great storytelling can arouse emotions – and censorship. “Increasingly, books are being challenged by school boards or parent groups, and that’s definitely something I’ve experienced several times with books I’ve edited – although interestingly enough, none have been the ones by Adam!” said Candlewick’s Elizabeth Bicknell, who has edited many of Rapp’s books (including The Children and the Wolves, due out in fall 2011). “It’s impossible not to offend somebody, somewhere, some time.”

The proof: the American Library Association’s list of banned and challenged books. Over the years, it has included illustrious authors such as Philip Pullman, Phyllis Reynolds Naylor, Robert Cormier, Toni Morrison, Maya Angelou, J.K. Rowling, Judy Blume, and Lois Lowry.

Currently, Rapp is in Seattle, working on Welcome Home, Dean Charbonneau, a play about a welcome-home dinner for a young soldier. This time around, he did not base it on anything in his life, in any way.