NEW YORK — Banned Chinese writer Liao Yiwu, speaking in the United States for the first time since fleeing his country, said that his only crime was to resist “brainwashing.”

Liao, who spent four years behind bars for writing the poem “Massacre” about the 1989 Tiananmen Square crackdown, said personal freedom in China is only granted to those who surrender their spiritual freedom.

“In China, the biggest problem is brainwashing. If you don’t have your memory, or your conscience, everything is possible — but you have to forget about your personal stories,” Liao told an event of PEN, a group of authors active on human rights, at New York’s New School.

Liao said he would have “lived a very good life in China” if he had stopped trying to think independently.

The author of the newly released God is Red: The Secret Story of How Christianity Survived and Flourished in Communist China, said he is not a political activist, but was persecuted simply for telling the stories of ordinary people.

In his earlier book, The Corpse Walker: Real Life Stories, China From the Bottom Up, he recounted tales of people on the margins of the economic superpower’s deeply repressed society.

“I first started wanting to tell stories when I was in prisons. I was locked up with unique people,” he said, including people traffickers, murderers and thieves. “Gradually my brain was turning into a tape recorder.”

“When I was first locked up I was a political prisoner. I didn’t think I had anything in common,” he said, speaking through a translator.

“I felt like my brain was exploding. I couldn’t even take their stories any more. But it was like the only path for them: they wanted to tell their stories to me and they wanted to tell me before they were executed.”

“All the people I have interviewed, they have no interest in politics, but they want the freedom to express themselves.”

In his new book, “God is Red,” Liao explores the way that rural Chinese defy official restrictions to follow Christianity.

Liao said that while he is not a Christian, he admires their determination and faith.

Like other forms of self expression, all religions are permitted on one condition: “First you have to believe in the Communist Party.”

“If you are willing to pursue your freedom, seek out your freedom, then you could be in trouble,” he said.

Liao, who also played traditional Chinese instruments at the PEN gathering and gave an intense recitation of “Massacre,” is renowned for his straightforward approach to his subjects, his quiet humor and courage.

Novelist Salman Rushdie introduced the Chinese writer on stage as one of “the few people who are the real writers” around the world.

Liao did not discuss details of his departure from China earlier this year, when he walked into Vietnam before making his way to Germany.

However, his more personal stories are becoming known through a prison memoir, which has sold briskly in Germany, but has yet to be translated into English.

He told the audience Tuesday that he was known to other prisoners as “the big lunatic” for his defiant gestures.

When a thief on death row asked him to organize for him “the same memorial service as accorded to a senior Chinese leader, Liao obliged, writing a eulogy that got him sent into solitary confinement as a punishment for 23 days. “That’s why they called me the lunatic.”

During his three days in New York, Liao said he had been stunned to find a huge immigrant Chinese community in Flushing, an area of Queens. “I’ve never seen so many Chinese,” he said to laughter, before describing how he ran into “swindlers” trying to sell fake telephones.

“It feels like that’s going to be China without communism,” he said to more laughter.

China this year launched one of its biggest crackdown on dissent in years in response to a wave of pro-democracy uprisings in the Middle East.

Acclaimed artist Ai Weiwei was detained for nearly three months and last year’s Nobel Peace Prize winner Liu Xiaobo, a writer and activist who has been active in the Independent Chinese PEN Center, remains detained.

Liao was barred from attending literary festivals in New York and Sydney earlier this year prior to his self-exile.