Four decades ago this Sunday, the Rev Jim Jones, the charismatic leader of an American cult in the Guyanese jungle, ordered his followers to murder a US congressman and several journalists, then commit mass suicide by drinking cyanide-laced fruit punch.

The Jonestown massacre was, before 9/11, the largest single incident of intentional civilian death in American history. More than 900 people died, many children. It was also a devastating cultural trauma: the end of the last strains of a certain kind of 1960s idealism and 1970s radicalism. Jonestown’s legacy lives on in the ironic phrase “drink the Kool-Aid”. (In actuality it was Fla-Vor-Aid.)

Although he would later become a symbol of the darker side of the west coast counterculture, Jim Jones was born to a poor family in Indiana. Described as an intelligent and strange child, Jones was instinctively attracted to religion, especially charismatic Christian traditions like Pentecostalism. He cut his teeth as a street preacher, and was, unusually for the time and place, a passionate advocate for racial equality.

Jim Jones and his wife Marceline Jones, seated in front of their adopted children and next to his sister-in-law, right, with her three children, California, 1976. Photograph: Don Hogan Charles/Getty Images

Jones’s idiosyncratic blend of evangelical Christianity, New Age spirituality and radical social justice attracted an enthusiastic following. He called his burgeoning church the Peoples Temple.

Although Jones’s followers would later be stereotyped as sinister, brainwashed idiots, the journalist Tim Reiterman argues in his seminal book on the subject that many were “decent, hardworking, socially conscious people, some highly educated”, who “wanted to help their fellow man and serve God, not embrace a self-proclaimed deity on earth”. The Peoples Temple advocated socialism and communitarian living and was racially integrated to an exceptional standard rarely matched since.

In 1965, when Jones was in his mid-30s, he ordered the Peoples Temple moved to California. He drifted away from traditional Christian teachings, describing himself in messianic terms and claiming he was the reincarnation of figures like Christ and Buddha. He also claimed that his goal all along was communism, and, in a twist on the famous dictum that religion is the “opiate of the masses”, that religion was merely his way of making Marxism more palatable.

By the 1970s, the Peoples Temple, now based in San Francisco, had gained significant political influence. Jones’s fierce advocacy for the downtrodden earned him the admiration of leftwing icons like Angela Davis and Harvey Milk and the support of groups like the Black Panthers – a tragically misguided political affinity, given that more than two-thirds of Jonestown’s eventual victims were African American.

The Rev Jim Jones and his wife, Marceline, taken from a photo album found in Jonestown, Guyana. Photograph: Bettmann Archive

The Peoples Temple was, as David Talbot notes in Salon, successful in part because it was politically useful: “Jones could be counted on to deliver busloads of obedient, well-dressed disciples to demonstrations, campaign rallies, and political precincts.”

There were already signs, however, of a sinister undercurrent to the Peoples Temple. Followers were expected to devote themselves completely to the church’s utopian project: they turned over their personal wealth, worked long hours of unpaid labor for the church and often broke contact with their families. They were expected to raise their children within the commune. As a show of commitment, Peoples Temple members were asked to sign false testimonials that they had molested their children, which the church kept for potential blackmail.

In his 1980 study of Jonestown, the writer Shiva Naipaul, younger brother of VS Naipaul, argued that the Peoples Temple was at heart a fundamentalist religious project – “obsessed with sin and images of apocalyptic destruction, authoritarian in its innermost impulses, instinctively thinking in terms of the saved and the damned”.

The result, Naipaul wrote, “was neither racial justice nor socialism but a messianic parody of both”.

Jones, who had long believed the US was in danger of imminent nuclear holocaust, had been searching for a place where his church would be “safe” during an apocalyptic event. A magazine article alleging abuse in the Peoples Temple spurred Jones’s desire to relocate. He chose Guyana, a former British colony in South America whose socialist regime was politically sympathetic.

In 1977 the Peoples Temple moved its headquarters to a remote area of Guyanese wilderness. Here, Jones declared, they could build a utopian society without government or media meddling. Battling an oppressive tropical climate and limited resources, they began to convert the dense jungle into a working agricultural commune, soon known as “Jonestown”.

The Peoples Temple office in Georgetown, the capital of Guyana. Photograph: Ken Hawkins/Alamy

The church delivered Jones’s rambling monologues to Jonestown’s inhabitants by megaphone as they worked. In the evenings they attended mandatory propaganda classes. Jones’s writ was enforced by armed guards called the “Red Brigade”.

Jonestown had little reason to expect interference from Guyana – a “cooperative republic” whose government happily ignored signs of the cult’s authoritarian and paranoid bent. Back in the US, however, parents of Jonestown inhabitants – concerned by the strange letters, or lack of letters, they received from their children – had been lobbying the government to investigate.

After a family in the US won a custody order for a child in Jonestown, paranoia escalated. The commune became an armed camp, ringed by volunteers with guns and machetes, threatening to fight outsiders to the death.

During the (imaginary) siege, Black Panthers Huey Newton and Angela Davis spoke to Jonestown inhabitants by radio patch to voice solidarity. Davis told Jonestown inhabitants that they were at the vanguard of revolution, and right to resist what she called “a profound conspiracy” against them.

Sometime during this period Jonestown began drills called “white nights”, in which inhabitants would practice committing mass suicide.

Jackie Speier, an aide to Congressman Leo Ryan, survived five gunshots. She is now a congresswoman representing California’s 14th district. Photograph: Bettmann Archive

The NBC News soundman Steven Sung, survivor of the ambush at the airstrip, is evacuated. Photograph: Larry Downing/AFP/Getty Images

At the behest of concerned family members in the US, the California congressman Leo Ryan organized a delegation of journalists and others to make a fact-finding mission to Jonestown.

The delegation arrived at Jonestown on 17 November 1978 and received a civil audience from Jones, but the visit was hastily called short on 18 November after a member of the commune tried to stab Ryan. The delegation headed back to the airstrip, accompanied by a dozen Jonestown inhabitants who had asked to leave the commune, and escorted by Jones’s watchful deputies.

The delegates never made it off the ground. As they boarded the planes, their escorts drew guns and opened fire. They shot Ryan dead, combing his body with bullets to make certain, and killed four others – including two photographers who captured footage of the attack before dying. Wounded survivors ran or dragged themselves, bleeding, into the forest. (One of Ryan’s aides, Jackie Speier, survived five gunshots and is now a congresswoman representing California’s 14th district.)

Back at Jonestown, Jones announced that it was time to undertake the final “white night”. To quell disagreement, he told inhabitants that Congressman Ryan had already been murdered, sealing the commune’s fate and making “revolutionary suicide” the only possible outcome.

The people of Jonestown, some acceptant and serene, others probably coerced, queued to receive cups of cyanide punch and syringes. The children – more than 300 – were poisoned first, and can be heard crying and wailing on the commune’s own audio tapes, later recovered by the FBI.

When Guyanese troops reached Jonestown the next morning, they discovered an eerie, silent vista, frozen in time and littered with bodies. A tiny number of survivors, mainly people who had hidden during the poisoning, emerged. One elderly woman, who slept through the entire ordeal, awoke to discover everyone dead. Jones was found dead of an apparently self-inflicted gunshot.

The hypodermic syringes and vials filled with cyanide and animal tranquilizer used in the mass murder-suicide.

Photograph: Ken Hawkins/Alamy

US military personnel remove American bodies from Jonestown, Guyana, for repatriation. Photograph: Ken Hawkins/Alamy

One of the journalists attacked on the airstrip, Tim Reiterman of the San Francisco Examiner, survived two bullet wounds and went on to write Raven: The Untold Story of the Rev. Jim Jones and His People, still considered the definitive history of the Jones cult.

Reiterman has argued that it is impossible to separate Jonestown from its political and social context. The “Peoples Temple was – as many communes, cults, churches and social movements are – an alternative to the established social order, a nation unto itself”, he wrote in Raven. “The Temple I knew was not populated by masochists and half-wits, so it followed that the members who gave years of labor, life savings, homes, children and, in some cases, their own lives had been getting something in return.”

He “recoiled”, Reiterman added, “when outsiders took the attitude that they or their children would never be crazy or vulnerable enough to join such an organization. Such complacency is self-delusion.”