Federal agents trying to build an extortion case against Joran van der Sloot secretly gave him the cash that wound up funding his trip to Peru, where he killed a young woman exactly five years after the disappearance of Natalee Holloway, The Post has learned.

Van der Sloot tried to shake down Holloway’s mother by offering information about her daughter’s 2005 disappearance, and agents decided to set him up with a $25,000 payoff, a source told The Post yesterday.

An intermediary acting under the direction of the FBI gave van der Sloot the dough in Aruba on May 10 — and four days later, he flew to Peru, where he allegedly murdered 21-year-old Stephany Flores in his Lima hotel room.

Van der Sloot was free to travel because after the money was given to the 22-year-old Dutch national, the feds didn’t promptly file charges against him. US authorities also did not ask that he be detained in Aruba, even after officials there warned that he was about to leave the island, the source said.

The failure to stop van der Sloot shocked and infuriated Holloway’s mom, Beth Twitty. She had been “told that an arrest was going to happen before he left” Aruba, where he was the last person believed to have seen Holloway alive when she vanished, the source said.

Van der Sloot took his payola from the feds — a $15,000 wire transfer and $10,000 in cash — and went to Peru to play poker, the source said.

It was only last Thursday — hours after van der Sloot was nabbed on the lam in Chile for Flores’ murder — that federal prosecutors in Alabama announced they were charging him with extortion and wire fraud in the Holloway shakedown.

Van der Sloot has confessed to beating Flores and breaking her neck in his hotel room on May 30 — the fifth anniversary of Holloway’s disappearance — according to the confession he gave Peruvian police.

The suspect said he attacked Flores — whom he had met at a Lima poker tournament — because she had looked at his laptop computer without permission and found information about his role in the Holloway case.

“I did not want to do it,” van der Sloot told cops, according to La Republica newspaper. “The girl intruded in my private life. She had no right.

“I confronted her. She was frightened, we argued, and she wanted to get away. I grabbed her by the neck and hit her.”

Van der Sloot is expected to recreate the crime at the scene for cops today.

A coroner in Lima said Flores likely had been beaten to death with a tennis racket found in the room. A source told CNN that van der Sloot admitted to being high on marijuana during the vicious assault.

Twitty yesterday refused to comment on either the extortion case or Flores’ murder, as she appeared at Washington’s National Museum of Crime and Punishment, where she was opening the Natalee Holloway Resource Center for families of missing loved ones.

But Twitty said, “Let’s all . . . keep the Flores family in our hearts and in our prayers.”

Van der Sloot and two other men from Aruba are the last known people to have been with the 18-year-old Holloway before she vanished during a high-school graduation trip to the Caribbean island.

Van der Sloot was arrested twice by Aruban authorities, but was never charged because of lack of evidence.

Over the years, he has made a series of sometimes conflicting statements about what happened to the Alabama teen.

Then, around March 29, he contacted high-profile New York lawyer John Kelly, who had represented Holloway’s mom in an ultimately unsuccessful lawsuit against van der Sloot.

“Joran reached out and said something like, ‘My dad died, and we need some cash. If you guys give me some money, I’ll come clean, and give you the whole story’ ” about Holloway, according to one source.

Van der Sloot’s dad, a lawyer in Aruba, died while playing tennis there in February.

The suspect originally demanded $250,000 from Twitty, an Alabama resident, in exchange for his information, according to federal authorities.

After some negotiation, a source said, a meeting was arranged in Aruba between van der Sloot and someone who was ostensibly acting on Twitty’s behalf.

That meeting was secretly videotaped by the FBI, the source said.

At the meeting, Twitty’s representative “gave him $10,000 in cash” and had another $15,000 wired — purportedly from the mom to a financial institution in Aruba, which is a territory of the Netherlands.

Van der Sloot “counted the money twice,” the source said.

“It was sting money, it was the FBI’s money,” the source said.

“The f- – -ed-up part is, why didn’t they arrest him then and there?” the source said.

An Interpol document says that in exchange for the money, van der Sloot showed the intermediary a house where Holloway’s remains were supposedly hidden, CNN reported.

But records soon showed that the house wasn’t even built when she disappeared — and van der Sloot immediately confessed that he had been lying, the news channel said.

Shortly after that meeting, “the FBI was warned by Aruban authorities that he was leaving the country,” the source said. “And the FBI apparently did nothing.”

“I did hear that [Holloway’s family] was p- – -ed off. They were told that an arrest was going to happen before he left. And he left,” the source said. “[Twitty] was pretty upset.

“This would have given them the opportunity to have their day in court with him in the United States.”

Instead, van der Sloot arrived in Peru on May 14.

There, he met Flores, the daughter of a local businessman and politician, and spent several days with her before killing her, the source said.

Asked yesterday why prosecutors didn’t charge him sooner, US Attorney spokeswoman Peggy Sanford said, “We did not obtain an arrest warrant until we had sufficient evidence to support the charges.”

Asked what additional evidence authorities needed to obtain, she said, “I just can’t comment on that.”

An FBI spokesman refused to comment.

The Interpol document states that the feds have asked Peru to start the extradition process to bring van der Sloot to the United States, CNN said.

Additional reporting by Geoff Earle in Washington

dan.mangan@nypost.com

