KUALA LUMPUR, Malaysia — First came the banning of a gay arts festival and the book “Islamic Sex.” Then the cancellation of U.S. singer Erykah Badu’s concert after a publicity photo showed her with an “Allah” tattoo.

Next on the banned list was British author Peter Mayle’s sex-education book “Where Did I Come From?” and, in May, “Allah, Liberty & Love” by liberal Muslim activist Irshad Manji, which calls for reform and greater tolerance within Islam.

Although state religious officials in Malaysia say preventing citizens’ exposure to “un-Islamic” books, authors and entertainers is a moral necessity, opposition leaders offer a different view: It’s largely about political power.

With polls suggesting a recent erosion in support for Prime Minister Najib Razak and the ruling party, particularly among younger, tech-savvy voters, the government has been working overtime to solidify its support among the country’s Muslim Malay majority. And one way it has done that, analysts said, is by fanning fear of secularism and the spread of religions other than Islam.

“That is why you see a concentrated attempt to win them over by being ultra-religious,” said Ahmad Farouk, chairman and director of the Islamic Renaissance Front think tank, who believes Malaysia’s differences should be celebrated, not condemned. “We can’t behave or think like a 7th century Muslim. We are already in the 21st century.”

Critics charge that stepped-up appeals to “Islamic values” by the ruling United Malays National Organization party may exact a larger cost, dividing society, eroding Malaysia’s significant accomplishments and undercutting the confidence it enjoys among foreign investors.

“Malaysia’s reputation has been dented for many years by these shortsighted attempts to win local votes,” said Ooi Kee Beng, deputy director of the Singaporean-based Institute of Southeast Asian Studies. “It’s never what’s good for society, rather what’s good for the party.”

Those close to the ruling party, including former Prime Minister Mahathir Mohamad, counter that lax morality and a weak hand at the wheel could spark ethnic violence and social disorder.

“When you open up things, you become liberal,” Mahathir told the Agence France-Presse news service in a June interview. “We need a government that is firm.”

In late April, nearly 250,000 people marched through Kuala Lumpur, the capital, calling for free and fair elections, rattling the ruling party.

State religious scholars condemned the demonstrations and issued an edict, or fatwa, against Muslims participating in street protests.

Muslims make up 60% of Malaysia’s 28 million people, while Christians account for about 9%. Several churches were firebombed in January 2010 after the country’s high court allowed the Catholic Church to use the term “Allah” in Malay translations of the Bible.

The country also has sizable ethnic Chinese and ethnic Indian communities that chafe under rules guaranteeing Muslim Malays preferences in politics, business and education.

New York-based author Manji said she knew trouble was brewing when her scheduled mid-May book talks in Kuala Lumpur were canceled at the last minute for “security reasons,” which she attributes to government pressure and “extremist groups that sometimes pass themselves off as mainstream.”

After a last-minute scramble, she and her publisher found one community center willing to host her, defying a Home Ministry pledge to block her public appearances.

Days later, as word spread that she had pulled an end run, the book was banned, copies seized and her Malaysian publisher, Ezra Zaid, was briefly arrested by State Islamic Affairs officials after he threatened to challenge the ban in court.

“This issue here is more than just banning the book,” Zaid said. “It exposes the fact that these religious agencies believe they can act in a lawless fashion in the name of Islam.”

For her part, Manji said she’s not particularly surprised that Malaysia banned her book, just that it did it so soon.

“Malaysia is very much fighting for its soul,” she said. “Governments, for the sake of order and stability, are equating politics with faith.”

“The good news is that many young Malays are not falling for this,” she added. “There’s nothing faithful about it.”

mark.magnier@latimes.com

Special correspondent Sam reported from Kuala Lumpur and Times staff writer Magnier from New Delhi.