While filming in a desolate area of Australia for Animal Planet's "River Monsters," a television crew spotted a man who had become separated from his boat and spent days trapped on a deserted island. (Animal Planet)

Temperatures had hit triple digits when the camera crew spotted a sun-soaked man stranded on an island surrounded by rough waters off Australia’s northern coast.

Animal Planet host Jeremy Wade and his crew were searching for a rare fish called the Queensland grouper, for a segment for the documentary series “River Monsters,” when the man emerged from a cave on an uninhabited island in the Gulf of Carpentaria, some 60 miles from land.

The castaway — dehydrated and disoriented — heard the engines and ran toward them. He started shouting and then waving for help.

“He immediately came down to the water, and he’s yelling out, ‘Give me something to drink, give me something to drink,'” Wade said in the segment, which aired on Animal Planet last week.

(Courtesy of Animal Planet)

The crew members found him in November on the Sir Edward Pellew Group of Islands after they took a turn to find calmer waters for the shoot.

“We first of all saw a cooler on the rocks and then one of us spotted — so there’s somebody there, there’s somebody there,” Wade said in the segment, adding that the man was “pretty desperate.”

The man was identified by the film crew only as Tremine, a hobby fisherman from Borroloola, a tiny town in Australia’s Northern Territory.

They estimated he had been alone on the island for more than two days.

Upon spotting him, the crew sent a support vessel to bring him back to their boat.

Stephen Shearman, the episode’s director, told The Washington Post that the man told the crew members: “You’re a lifesaver, you’re a lifesaver!”

“I was up in here and down here because I seen turtle nests and heaps of empty bottles,” Tremine told the “River Monsters” crew moments after his rescue. “So I was hoping that one of the bottles might have a bit of water in it.

“But I didn’t see no water in it.”

Shearman said he told crew members that he had been “preparing to die.”

“He had said his last prayer,” Shearman told “Inside Edition.”

“He was prepared to die and meet his maker.”

Tremine had gone fishing in the Barranyi (North Island) National Park and left his boat behind to scout out a beach nearby, Shearman said.

“After an hour, he reached a beach, which he didn’t recognize,” Shearman told The Post in an email. “He tried to walk back but the effects of heat stroke had begun to take a toll on him and he was disoriented.

“He set out again but was beaten back by the sun. He then decided to spend the night on the beach. The next morning, he was swinging from freezing to over-heating — classic heat stroke symptoms.”

Shearman said Tremine told them he tried to eat some oysters, but couldn’t keep them down.

“He spent the whole of the second day and second night in a small cave,” he said. “The morning of the third day is when we discovered him.”

(Courtesy of Animal Planet)

In the “River Monsters” segment, Tremine was seen sweating and sipping water on the film crew’s boat.

They gave him water and rehydration tablets, Shearman said, but he immediately threw them back up.

Shearman said the crew members took Tremine to their lodge to rest, and the next day he went home.

“I remember that evening when we were all back in the lodge how quiet he was — just kept shaking his head,” Shearman said. “His life hung by the thinnest of threads.”

“River Monsters” airs on Animal Planet at 10 p.m. EDT on Thursdays. This story has been updated.