Nxivm had all the hallmarks of a money-scamming cult — but the truth was far, far worse.

Devotees of the upstate self-help organization pay thousands of dollars for seminars, wear colored sashes denoting their “rank,” spout Scientology-like jargon, and literally bow before leader Keith Raniere — whom they call “The Vanguard.”

Nxivm (pronounced “Nexium”) has deep pockets, outposts around the world, and draws celebrity attendees, including actresses Allison Mack, Kristin Kreuk and Nicki Clyne, and even hosted the Dalai Lama at an event in 2009.

But behind the scenes, Raniere has been blackmailing his female followers into becoming sex slaves branded with his initials, while other women in the group were made to wear fake cow udders on their bare breasts in acts of ritual humiliation, federal prosecutors allege.

On Monday, Raniere’s secret world came crashing down when authorities tracked him down in Mexico after a months-long manhunt and arrested him for sex trafficking and forced labor.

He was arraigned in Texas on Tuesday and will now be brought to Brooklyn to face justice after what prosecutors say has been a lifetime of scamming and abusing women.

Born in Brooklyn in 1960 to an advertising executive dad and former dance teacher mom, who raised him in the suburbs, Raniere claims to have been a child prodigy who achieved the 1989 Guinness World Record for “Highest IQ” and boasts of obtaining three degrees from Rensselaer Polytechnic Institute in Troy, NY.

In reality, investigators say, Raniere struggled to complete his courses and graduated with a 2.26 GPA — “having failed or barely passed many of the upper-level math and science classes he bragged about taking,” Brooklyn US Attorney Richard Donoghue wrote in court documents.

Whatever the truth, those who know Raniere frequently describe him as a deeply charismatic man who easily convinces others of his own brilliance.

As early as 1984, at age 24, he manipulated a 15-year-old girl into a four-month sexual relationship, the woman, Gina Melita, told the Albany Times Union.

He took her to video game arcades, where he was partial to an Atari shooter called “Vanguard” — the title he would later adopt as leader of Nxivm.

After working various gigs, including as an Amway salesman, Raniere made his first foray into multilevel marketing in 1990, with a buyers’ club called Consumers’ Buyline that soon boasted 200,000 members nationwide.

That year, he also allegedly molested the 12-year-old daughter of a Consumers’ Buyline employee, after grooming her as her tutor, according to the victim.

“I was perfect picking — insecure at the time,” the victim, who later reported Raniere to local police, told the Times Union. “To have someone that mature and that well thought of to be interested in me, it was flattering. I was young, inexperienced, overwhelmed, out of my league.”

The girl’s case was never prosecuted, but Consumers’ Buyline quickly attracted the attention of authorities as a suspected pyramid scheme, and in 1996, Raniere settled a lawsuit with the New York state attorney general, agreeing to shutter the company and pay a $40,000 fine.

A year later, the smooth-talking salesman met a nurse named Nancy Salzman — a practitioner of hypnosis and neurolinguistic programming — rebranded himself as a self-help guru for business bigwigs, and together they formed a training center called Executive Success Programs, just outside Albany.

It was a hit.

Within five years, thousands of people had bought into Raniere’s hype and taken his seminars at satellite centers across the countries, including high-profile figures like Black Entertainment Television co-founder Sheila Johnson, former US Surgeon General Antonia Novello and Emiliano Salinas, the son of former Mexican President Carlos Salinas de Gortari.

Sisters Clare and Sara Bronfman, heiresses to the Seagram’s liquor fortune, became devotees of the group, renamed Nxivm, in 2002 — bringing their large pocketbooks with them.

But the next year, people started asking questions when Forbes published a bombshell report revealing not only Raniere’s past with Consumers’ Buyline, but also the group’s eyebrow-raising practices.

“I think it’s a cult,” Edgar Bronfman Sr. bluntly told the magazine, explaining that his daughters had donated millions and hadn’t spoken to him in months.

Upon the article’s release, actress Goldie Hawn pulled out of a scheduled speaking engagement at an Nxivm event.

But stunningly, the sashes, the bowing, the hero worship and the bizarre monikers masked far more disturbing things going on behind the scenes.

From the earliest days, Raniere parlayed his female followers’ devotion into sexual relationships — keeping “a rotating group of 15 to 20 women with whom he maintains sexual relationships,” prosecutors wrote in their criminal complaint.

Many lived with him at his Clifton Park, NY, townhouse, while other followers moved nearby.

“I found it fascinating that these beautiful, smart women knew about each other and didn’t seem upset to share Keith,” said Christine Marie, who was hired by the company in 1998 and soon began a sexual relationship with Raniere.

“Still, it seemed like secret polygamy to me,” she said.

Raniere’s twisted sexual beliefs made their way into the Nxivm curriculum, too, with “disturbing hypotheticals” that challenged “whether incest and rape are actually wrong,” prosecutors charge.

Raniere “physically assaulted at least two intimate partners” and punished one 20-something Nxivm member who developed romantic feelings for someone else by keeping her confined for 18 months, according to court documents. And he created a spin-off “men’s movement” where women were humiliated for their inherent “weakness” by being “forced to wear fake cow udders over their breasts while people called them derogatory names,” prosecutors allege.

Some of Raniere’s sexual history, including with underage girls, was exposed in a 2012 series of articles in the Times Union.

Yet Nxivm continued to operate and prosper, thanks in part to the Bronfman sisters’ ability to bankroll lawsuits against a growing number of critics, according to a 2010 Vanity Fair profile of what it called a “multi-million-dollar, multi-front legal war.”

In 2015, things got even more disturbing.

That’s the year Raniere formed a secret society within his secret society called “The Vow” — where “women were recruited to be slaves under the false pretense of joining a women-only mentorship group.”

Female Nxivm members were told they “had an opportunity to join an organization that would change [their] life,” but had to provide “collateral” — like sexually explicit photos, or videos accusing friends and family of horrendous acts — to get in.

Among those who signed up were Canadian actress Sarah Edmondson and India Oxenberg, the daughter of “Dynasty” star Catherine Oxenberg.

Only once the women had handed over the collateral that were they told they were now a “slave,” subservient to another slave who was now their “master,” prosecutors say.

Many of the women say they were branded near their groins with Raniere’s initials in a filmed “ceremony,” as other slaves held them down.

“It was like a bad horror movie. We even had these surgical masks on because the smell of flesh was so strong. I felt petrified. I felt — every part of my body was like: Get out of here. Run,” Edmondson wrote in Vice.

The women were also ordered by their masters to have sex with Raniere, and endure torture, including sleep deprivation, ice-cold showers and extreme low-calorie diets, prosecutors say.

When the secret slave society was revealed in an October 2017 article in The New York Times, the FBI began probing Raniere and Nxivm — and he fled to Puerto Vallarta, Mexico, with the help of Clare Bronfman’s cash, according to court documents.

He attempted to go off the grid, using a bank account in “one of his dead lover’s names” that was stocked with $8 million, as law enforcement closed in.

But even as Raniere was hauled away from the luxury villa where he was hiding out, his pull on female followers remained strong — they jumped in a car and tried to chase him down in a high-speed pursuit, according to Donoghue.

Additional reporting by Priscilla DeGregory