WEST PALM BEACH — Hours of telephone conversations between a Palm Beach County Sheriff’s investigator and a woman with whom the detective was obviously smitten have revealed shocking and possibly illegal activity inside the agency led for a third term by Sheriff Ric Bradshaw.

In the wireless pillow talk the investigator, whose identity we confirmed as 30-year Internal Affairs veteran Kenneth “Mark” Lewis, 56, allegedly broke elementary policing rules and state laws as he lifted the veil off a dark corner of the 4,400-worker agency that costs taxpayers half a billion dollars a year.

While the rumor for more than a decade has been that no credible candidates agree to run against Bradshaw because they fear retaliation, Lewis says in his conversations with a woman he’s never met that his job at PBSO is to investigate “those who attack the sheriff, judges and the state attorney.”

Lewis says he has traveled all over the country and Canada, and used the help of a hacker who officially runs PBSO’s website, in expensive, multi-year efforts to dig up dirt about a political opponent and at least one blogger.

What do they both have in common?

They challenged Bradshaw’s administration!

Here is Lewis telling his long-distance galpal that checking on those who “attack” the sheriff is “just what I do,” including probes into opponents’ finances and family tree:

In one case, the detective admitted to have “a filing cabinet full of information” about PBSO critic and blogger Mark Dougan, despite the fact Dougan has not been charged with a crime.

An FBI source told Gossip Extra this morning that the publishing of the tapes on an obscure off-shore website has caught the attention of public integrity agents in Miami who have been secretly looking into PBSO for months.

Mark Dougan, two years ago in Moscow! (Special to Gossip Extra)

“They’re doing it out of Miami because they didn’t want to involve the West Palm Beach bureau,” the source said. “This might be the information they were looking for.”

Gossip Extra interspersed key elements of this story with actual audio of the detective’s conversation.

Keep in mind that the brief discussions you hear were culled from more than 10 hours of raw audio!

Who’s Mark Lewis?

Within PBSO, Mark Lewis officially is a part-time IA investigator assigned to the lowly task of background checks on new recruits.

Unofficially, the Pahokee resident is known to be one of Bradshaw’s trusted enforcers and a personal friend of Chief Deputy Mike Gauger. He’s described as a gregarious, chatty investigator with a direct line to the bosses. He’s known for following cases through to the bitter end.

“Mark’s a great guy,” a former Internal Affairs employee said, “but everybody in the office knows he has a direct communication path to the brass.”

When he received his first call from a New York City woman who wanted to hire him because Lewis also has a contractor’s license, Lewis and the caller struck a friendship — and Lewis started spilling the beans about his job.

Among the revelations:

— Lewis bragged of traveling to Michigan and Canada and searching public records for two years to find dirt on then-Sheriff candidate Jim Donahue, who got arrested in March 2011. A nationally renowned law enforcement consultant with no criminal record, the 67-year-old Donahue ran against Bradshaw after he discovered what he claims was PBSO’s mismanagement of $15 million earmarked for new technology. Six weeks after Donahue filed his candidacy, he was charged with five counts of altering public documents and arrested during a police symposium in Fort Lauderdale. Donahue abruptly left the campaign trail but days before his trial in 2012, prosecutors mysteriously dropped the charges:

— Lewis tells the woman about an open investigation against local blogger Mark Dougan, the founder of pbsotalk.com, nicknaming his “suspect” Mr. Creepy. The investigation against Dougan, whose website allows service members to post information without having to reveal their identity, started four years ago and took Lewis to California, he says. To this day, no charges have been filed. Why? Listen to Lewis telling the woman that Dougan is actually protected by the First Amendment:

In another conversation, Lewis tells the woman that PBSO intercepted cellphone photos that Dougan was taking on a trip to Russia two years ago, and tried to identify who he was hanging with:

Lewis also admits that PBSO hacked into Dougan’s computer system:

In another conversation, the PBSO detective tells the woman he’s amazed Dougan is still alive:

— For good measure, Lewis went into investigative techniques that include the use of PBSO contractor Anthony Rodriguez, a contractor who officially works as the webmaster of pbso.org, the sheriff’s website. Lewis also said PBSO has a van filled with electronic equipment that are parked near homes so that techs can obtain information from citizens’ personal computers:

Lewis also tells the woman how Rodriguez is a specialist at creating fake online communities, dubbed “soft communities.” In Dougan’s case, Lewis says they created a phony Facebook community of young hotties (who didn’t exist) in an attempt to entrap the married but separated Dougan:

Bradshaw, who’s up for reelection, does not comment on stories published in media organizations that he sees as hostile to PBSO. So we reached out to Lewis himself.

“I was onto that person and I figured she wasn’t who she claimed to be.”

Lewis says he now believes the caller was Dougan, who managed to turn the tables on PBSO thanks to a digital voice changer.

Not so romantic now, is it?

“We started suspecting this was a fake caller a couple days into it,” Lewis said. “I’ve been around the block a few times, so gimme some credit here. If a chick who claims to be rich calls you out of the blue and sends sexy pictures of herself, it’s likely to be too good to be true.”

Actually, Lewis’ demeanor on the tapes changed Friday, after he realized he didn’t even know his telephone pal’s last name after hours of chatting.

Donahue, the former candidate for sheriff arrested by Bradshaw’s deputies, said he wasn’t surprised by what he heard on the recordings this morning.

“Sheriff Bradshaw is without qualification the most corrupt public official I’ve ever met,” Donahue told us. “It is inexcusable for a county to keep voting for that man. He’s an embarrassment and I know he’ll burn in hell for what he’s done to taxpayers.”