When Joseph Smith, founder of the Mormon church, received a revelation in about 1831 in which he was commanded by God to break the law and take multiple wives, he at first resisted. He knew that if he embraced polygamy he would be castigated for it.

But then between 1834 and 1842 an angel came down to him, no fewer than three times, urging him to get on with it. In the last such appearance, the angel brandished a sword and threatened to kill Smith unless he “went forward and obeyed the commandment fully”.

You can’t argue with that.

And so it came to pass that Joseph Smith, visionary and creator of the Church of Jesus Christ of Latter-Day Saints, took to himself up to 40 wives, engaging in sexual relations with between 12 and 14 of them. They ranged in age at time of marriage, or “sealing” as the Mormons called it, from Fanny Young’s 56 to Helen Kimball who was just 14. Some of the women were already married before Smith “sealed” himself to them for eternity. (In some cases, these “sealings” were apparently not marriages as we would think of them, but were intended solely to matter after death.)

The fact of Smith’s long and prolific embrace of “plural marriage” is not in itself surprising – his adoption of the practice as a route to heavenly exaltation has long been discussed by historians and theologians. What is stunning is that the official version of his polygamist life has now been published by the Mormon church itself, an institution that in recent decades has gone out of its way to downplay the unconventional marital practices of its early male founders, not least Smith himself.

The account is given in an essay that has been posted on the official website of the Mormon church as part of a series of articles on the role of polygamy in the religion’s history. The essay presents Smith’s polygamist behaviour as the result of a literal revelation from God, underlined by the appearance of the angel enforcer who “came with a drawn sword, threatening Joseph with destruction”.

The publication is part of an attempt to open the church up and face some of its most contentious acts, such as its ban on black men of African descent being ordained into its lay priesthood or black men or women being married in Temple that lasted as late as 1978. The official Mormon historian and elder of the church Steven Snow told the New York Times : “There is so much out there on the internet that we felt we owed our members a safe place where they could go to get reliable, faith-promoting information that was true about some of these more difficult aspects of our history.”

The official account has stirred up an intense debate among Mormons who have been brought up to think of Smith as relatively unblemished by some of the quirkier behaviour of his peers. The Salt Lake Tribune, which covered the official history last month, has been bombarded with more than 5,000 comments .

Writing in the same newspaper , Kristy Money, a Mormon psychologist, warned that the church’s portrayal of Smith’s actions as the result of an order from God could have an adverse impact on young readers. She said the official history should make it clear that in the eyes of the modern leadership “Joseph may have erred in his practice of polygamy”.

In other respects, though, the church does not flinch from some of the more painful aspects of this dark element of its past. After Smith’s death, it makes clear, church leaders came up with a new policy in which they effectively lied to the world – stating publicly that monogamy was the only legal marriage under Mormonism while openly tolerating plural marriage within their ranks.

It also addresses the position of Joseph Smith’s wife, Emma, who was openly hostile to polygamy. It says that she was put through an “excruciating ordeal” and that, though she approved of four of Smith’s other marriages in later years, he kept many of his “sealings” hidden from her.

The Mormon church made a clean break with polygamy in 1896 when it accepted a deal with the US government in which it denounced the practice in return for the granting of statehood for Utah. A minority of believers refused to go along with the new protocol and, insisting that they were keeping true to the faith, continued to practice polygamy as the Fundamentalist Church of Jesus Christ of Latter-Day Saints. Small communities of polygamist Mormons remain to this day in small towns such as Hilldale on the border between Utah and Arizona.