JERUSALEM — A Palestinian atheist jailed for more than a month for sharing his anti-Islam views on the Internet has apologized for offending Muslims, and a Palestinian military spokesman said he expected “positive” developments in the case.

Rights groups have criticized his arrest as a demonstration of the limits on free speech under the Western-backed Palestinian Authority, which has trawled Internet sites like Facebook as part of a crackdown on dissent and unpopular views.

The 26-year-old blogger, Walid Husayin — who had called the Muslim God a “primitive Bedouin” and Islam a religion of “irrationality and ignorance” — apologized in a letter to his family and to all Palestinians and sought forgiveness for what he called his “stupidity.”

“I apologize for the offence I have caused against the monotheistic faiths, particularly Islam,” the letter read.

Palestinian military police arrested Husayin on Oct. 31 after he posted comments deemed offensive to Islam on his Facebook page and blog. Defaming Islam is a crime in the West Bank.

A friend said Husayin posted the apology on his blog on Nov. 29, most likely with the hope that it would lead to his release. He spoke on condition of anonymity because of the sensitivity of the issue.

He posted the apology from a Palestinian military lockup in the northern West Bank town of Qalqilya, his hometown. It was not known whether prison authorities were aware or if the letter was part of an agreement for his release.

He has yet to be charged, Palestinian military spokesman Ahmed Mubayad said Monday. He hinted at the possibility Husayin could be released in the coming days by saying “there’ll be something positive,” but did not mention the apology letter.

Husayin’s earlier entries attacking Islam on an Arabic-language blog have been taken down, though his remarks in an English-language post are still online.

On Sunday, New York-based Human Rights Watch criticized Husayin’s detention as a violation of freedom of expression and called for his release.

Palestinian Authority spokesman Ghassan Khatib declined to comment on Monday, saying he was still waiting for complete information on the case.

Husayin’s arrest rattled his religiously conservative town, Qalqilya, where he had been known as a quiet man who worked in his father’s barber shop and prayed with his family at the mosque on Fridays.

Husayin’s writing appeared aimed at provoking Muslims. He made Facebook profiles claiming he was God, called the Prophet Muhammad a philanderer and penned spoof verses of the Muslim holy book, the Qur’an.

Days after his arrest, shocked residents called for him to be killed as a warning to others.