There was a time when author and activist Ayaan Hirsi Ali believed it all: that, according to Islam, the infidel should die, that the Quran is infallible, that those who violated sharia law — thieves, gays, adulterers — deserved to be stoned to death or beheaded, as they were each Friday in a public gathering place she and her brother called “Chop-Chop Square.”

Today, she is that rare thing: a public intellectual who, despite death threats and charges of bigotry, calls for an end to Islam — not just as the faithful know it, but as we in the West think we know it.

“The assumption is that, in Islam, there are a few rotten apples, not the entire basket,” Ali tells The Post. “I’m saying it’s the entire basket.”

In her book, “Heretic,” Ali argues for a complete reformation of Islam, akin to the Protestant Reformation of the 16th century. Though her own education led her to reject Islam and declare herself an atheist, she believes that for the world’s 1.6 billion Muslims, there must be another way.

“If you are a child brought up to believe that Islam is a source of morality” — as she was, in Africa and Saudi Arabia — “the Muslim framework presents you with the Quran and the hijab. I don’t want to be cruel and say, ‘You grow up and you snap out of it.’ But maybe we who have snapped out of it have not done our best to appeal to those still in it,” she says. (Read more from “‘In Islam, They Are All Rotten Apples’: Ex-Muslim’s Call for Religion’s Reboot” HERE)