An American prosecutor whose murder shocked the tiny island state of Yap had made such dangerous enemies that she slept with a machete under her pillow.

Rachelle Bergeron, 33, also took her dog along for protection when she went for a jog around the tropical paradise covered in pristine beaches and surrounded by coral reefs.

But the family dog could do little to protect her when she was brutally gunned down in front of the modest home that she shared with her new husband last week. Both Bergeron and the dog were shot dead by unknown assailants.

Bergeron, a former New York human rights lawyer, was the acting attorney general on Yap, an island of 11,000 people in the South Pacific with a big human trafficking problem.

“It’s the most dangerous job in Yap,” said Amos Collins, a family friend, in an interview with ABC. Collins said he helped Simon Haemmerling, Bergeron’s husband and a local pilot, take her to the hospital after she was shot in the chest and leg at point-blank range Monday night.

During her more than four years on the island, located 500 miles southwest of Guam, Bergeron was outspoken about ending the child-sex trade-in Yap and the nearby islands that make up the Federated States of Micronesia, where local girls as young as 12 are forced to service seamen on ships docked in the harbors. The four Micronesian states are an independent republic closely associated with the US, which provides more than 70 percent of the local budget.

But in addition to taking on the pimps and traffickers, the pretty brunette with a forthright manner had no qualms about chastising her own bosses in the national FSM government for their failure to act.

“She cared passionately about ending sex trafficking,” said Dorchen Leidholdt, director of Sanctuary for Families, a New York non-profit that provides counseling and legal services for victims of sex trafficking where Bergeron once worked. “She was acutely aware of the violence involved in child sex trafficking. And she wasn’t afraid of confronting anyone.”

Bergeron’s battle against sex trafficking had taken her around the world. After graduating law school at the University of Florida in 2010, Bergeron, who grew up in Wisconsin, volunteered with International Justice Mission, a non-profit that works to protect the poor against violence in South Asia.

“Her colleagues remember her fighter spirit and zeal to be the very best lawyer she could be, because that is what she felt the poor deserved,” said Saju Mathew, regional president of the group.

Between 2011 and 2013, Bergeron worked with attorneys in India, preparing legal briefs and conducting research to help victims who were trafficked as slave labor, a spokeswoman for IJM told The Post.

Bergeron continued her crusade in New York, when she volunteered with Sanctuary for Families in Lower Manhattan just before she left for Yap. She produced a video for the group to warn local women about an increase in sex-trafficking during the week of the 2014 Super Bowl at MetLife Stadium in New Jersey. Bergeron and another volunteer teamed up with advertising firm McCann Erickson to create the video — “Not-So-Super” — as part of a campaign to raise awareness of the problem.

“She came to us at a really propitious time,” Leidholdt told The Post. “She helped create a very powerful video.”

Following her New York stint, Bergeron flew to Yap in the summer of 2015, eager to take up the assistant attorney general position and help local children and women on the 118-square mile island, which also has serious problems with domestic violence. More than 60 percent of those admitted to hospital in Yap are female victims of abuse, according to UN reports.

Despite its breathtaking scenery, life on Yap had its challenges for outsiders. Residents subscribe to a rigid set of ancient rules, in which women are generally in charge of gardening and cooking while men fish for a living. Women are frowned upon for showing their thighs, yet are encouraged to go topless in island ceremonies and dances. If women show up unaccompanied at a man’s home in Yap, they are presumed to be there for sex.

Still, Bergeron appears to have been happy on the island, which was relatively free of violent crime and where firearms are prohibited. Last year she married her German husband, who pilots small aircraft for Pacific Mission Aviation, an evangelical aid group. Bergeron wore a white dress and a set of elaborate crowns made from tropical local flowers for their barefoot ceremony on a beach. The couple was about to celebrate their first year of marriage and adopt a local child when Bergeron was killed.

The beginning of Bergeron’s appointment in the attorney general’s office coincided with a disciplinary action against a previous assistant attorney general who resigned in June 2015 and was later disbarred, public documents show.

‘She was acutely aware of the violence involved in child sex trafficking … she wasn’t afraid of confronting anyone’

The starting salary was $24,000 a year with an increase to $28,000 after passing the Federated States of Micronesia bar exam. Government housing was provided, as was a one-way ticket to the isolated island where there are only two flights out every week. At the end of a two-year contract, the government would pay for a flight back home. Bergeron agreed to stay on after her contract, and spent much of the last year filling in for the top prosecutor’s job.

“The office is currently staffed by both local and US legal counsel and is an informal, fun place to work,” said a recent ad seeking candidates to fill the assistant attorney general’s job after Bergeron moved up. “As Yap is a tropical island and thus hot year-round, suits or other formal attire are almost never worn. The ideal candidate will have a sense of humor as well as a strong work ethic.”

Months before starting her new job, controversy was brewing on the island after a group of impoverished migrants landed on its shores. The 34 Nepalese and Indian men had been duped by human traffickers on their way to Guam, where they had been promised jobs.

Bergeron found herself in the midst of a contentious local debate about the fate of the refugees, who were stuck on the island as federal immigration authorities bickered about what to do with them. They spent a year and a half detained on the docks in makeshift lean-tos, living on meager government food handouts and labeled a national security risk.

Islanders on Yap, where local customs dictate that they should treat visitors as part of their own families, were horrified by the situation but were prevented by the national government’s rules on immigration from helping the men, who were kept in isolation in filthy conditions with no running water or toilets.

Bergeron became their advocate and hers was the lone voice of protest against the national government.

“I don’t think that the situation was handled very well, ” Bergeron told the “Cook Islands News” in August, 2016, a year into her tenure a the assistant prosecutor. “So there were no sorts of checks and balances to ensure whether or not the men were provided with adequate food, what their shelter situation was like, if they needed access to medical care.”

Bergeron went on to criticize the national government for detaining them illegally, not providing them with legal counsel and keeping them in a state of isolation.

“The visitor ban has had a considerable negative impact on the men’s psycho-social well-being as they now have no means of communicating with the outside world,” she said.

The migrants were eventually sent back to their home countries after the United Nations intervened, but Bergeron wasn’t finished: She demanded radical changes to immigration laws in order to ensure that migrants are dealt with humanely in the future.

“She was selfless in all her work,” said Constantine Yowbalaw, director of youth and civic affairs on Yap, and now the state’s designated spokesman on Bergeron’s murder. “She’s been very vocal and very selfless in her work.”

Bergeron rose to acting attorney general after her predecessor resigned to become a judge earlier this year, Yowbablaw told The Post. He said that she was also on a judicial panel that had been charged with choosing his replacement.

But friends said she had received so many threats that she was looking forward to returning to the US with Haemmerling, and the young girl they were looking after. On the night Bergeron was shot, Haemmerling was in the kitchen making brownies.

“She was a target,” said Collins. “She had to deal with a lot of the worst things.”

When she wasn’t fighting national authorities, Bergeron was visiting local schools and community centers to warn children about the dangers of sex trafficking.

There are numerous photographs of Bergeron, her long hair tied in a bun and wearing flip-flops, on the Yap State Human Trafficking Task Force Facebook page speaking to children and adolescents.

Bergeron’s state-wide campaign to end sex trafficking in Yap started to gain traction when a case against two men, including an American, went all the way to the country’s Supreme Court earlier this year. The case resulted in the conviction of William Chunn, a local taxi driver, who was hired “to recruit, transport and deliver minor girls to have sex with sailors on shore leave,” court records say. Chunn would charge johns a fee and then deliver girls for sex, court records show.

Between 2015 and 2017, Chunn allegedly worked in conjunction with Joseph Parisi, who is a dual citizen of the US and Italy. Parisi was accused of paying for sex and buying drinks for underage girls. Parisi is on the lam after he violated his bail conditions and failed to show up for a Nov. 27 hearing, according to press reports.

‘She was a target,” said Collins…she had to deal with a lot of the worst things’

It’s not clear if Bergeron was actively involved in prosecuting sex traffickers before she died. Yap state court records posted online end at 2017, and Yowbalaw told The Post he did not know what kinds of cases Bergeron was working on. But after her death, and the recent resignation of an assistant attorney general who returned to her home in Australia, there are no prosecutors left in the office.

“It’s empty,” he told The Post. “Only the support staff is there.”

Next week, friends and family plan to conduct a memorial service on Yap, where Bergeron was well known to the community.

“We will remember Rachelle most for her love of life and pursuit of justice,” said her parents, Tom and Tammy Bergeron, in a statement last week.

After the memorial service, the family plans to fly back to the US with Bergeron’s remains. A friend’s GoFundMe campaign has so far raised more than $28,000 for her funeral costs.

There are no suspects in custody although the FBI is now working with local police on the case, Yowbalaw told The Post.