It was an unusual assignment, and Australian Federal Police officer Dave Moore wasn't happy about it.

"I had a call to go and visit the assistant commissioner," he recounted.

"He asked me to keep a lookout for a bloke by the name of Chris Masters from Four Corners."

"The Joke" was a system of protection involving illegal gambling, bookies and brothels. ( Four Corners )

To Mr Moore, babysitting a journalist was not part of his remit.

"I'll be honest, I told [my assistant commissioner] I didn't want to do the job," he said.

But an order was an order.

It was 1987, and the AFP hierarchy had information that Masters was in danger.

He wasn't at risk from the criminal underworld, but from the corrupt members of the Queensland police.

"It was made very clear that they were concerned for Chris's safety," said Mr Moore, speaking for the first time about the AFP's secret role in protecting the Four Corners reporter.

"So we put the resources of the AFP, discreetly, behind keeping a lookout for Chris."

'We were being watched and shadowed'

Masters was getting too close to a brotherhood of bent cops and their network of graft and corruption, an arrangement known as "the Joke".

What was the Joke? The Joke was a vast system of graft and protection involving illegal gambling, starting price bookmakers, brothels and massage parlours that stretched back decades in Queensland. The dirty money flowed to the police, particularly to several senior members of the infamous Licensing Branch, who in exchange for regular cash payments turned a blind eye to vice. In its later and most lucrative form, the Joke was administered by Jack Herbert, who, by the time it all came crashing down, was passing on nearly $60,000 a month in protection money to police. Herbert was estimated to have received more than $3 million in payments. In early 1987 The Courier-Mail ran a series of articles about unchallenged vice in Brisbane. Then in May, The Moonlight State program was broadcast on Four Corners, revealing that police were being bribed to protect vice in Queensland. The next day the acting premier Bill Gunn called a judicial inquiry. The Fitzgerald Inquiry would run for two years and hear from more than 300 witnesses. Evidence from the inquiry would lead to four government ministers and police commissioner Terry Lewis being jailed. Other police would go to prison, while senior officers — including the assistant commissioner Graeme Parker — would give evidence in exchange for indemnity from prosecution. The Fitzgerald Inquiry would also lead to the establishment of Queensland's first anti-corruption body.

Stretching back several decades, the Joke was a system of protection payments that flowed from brothel owners, SP bookies and illegal gaming operators into the hands of corrupt police.

It was worth millions, and the Joke's tentacles reached right to the top of the Queensland force.

In late 1986, early 1987, Masters had been sniffing around Brisbane's red light district of Fortitude Valley for weeks talking to pimps, prostitutes and disgruntled police.

His inquiries were making the brotherhood nervous.

"We were being watched and shadowed," Masters recalled.

"I didn't really know that until Dave started to point out people who were surveilling me."

Mr Moore says he first met Masters "up at the Tower Mill [Hotel]".

"It became quite apparent to me that there was someone paying quite a lot of attention to Chris across the road," he said.

"We later found out it was a hired vehicle which was being used by officers of the [Queensland] Police Force."

Chris Masters had been investigating corruption in Brisbane's red light district. ( Four Corners )

The plan to frame Chris Masters

As Masters got closer to cracking the Joke, the police brotherhood knew it had to destroy the Four Corners reporter before he destroyed them.

"They took him extremely seriously, to the point where they were on the brink of literally setting him up," said Matthew Condon, the author of a three-book series on police corruption in Queensland.

"The plan was that they would plant an underage boy in Masters' hotel room in the city and ultimately, whether they could prove it or not, the mud would have been thrown against Masters to discredit him."

Masters would only be told of the plan to stitch him up many months later, after The Moonlight State had gone to air.

"I learnt of it through [former rugby league player] Tommy Raudonikis. He'd heard of it from a police mate and he then tipped off my brother Roy who told me," Masters said.

"But when it was all supposed to happen I wasn't in Brisbane, I was back in Sydney."

The plan revealed the lengths the corrupt Queensland police brotherhood was prepared to go to protect the Joke.

It had flourished for years under the stewardship of a man known as "the Bagman".

Jack Herbert was a former police Licensing Branch detective who for years was the conduit between the crooks and the cops.

He doled out hundreds of thousands in bribes to corrupt police.

Masters travelled the state speaking to and interviewing people about the Joke.

On May 11, 1987, The Moonlight State went to air on Four Corners.

"The pivotal thing about The Moonlight State and why it caused an earthquake was that for the first time, what Masters achieved, was a link between criminal figures, the underworld and corruption and police," Condon said.

"That's what caused so much drama and why it was an astonishing piece of television journalism."

For Masters, the day after The Moonlight State would bring fresh drama.

"I wake up to the sounds of my own heartbeat," he said.

"These are scary moments, sometimes the worst moments because you've done your best, you're pretty much exhausted, but then a whole new battle begins."

That battle would become the Fitzgerald Inquiry.

It would run for two years, hear from 339 witnesses and see the police commissioner, Sir Terence Lewis, jailed and stripped of his knighthood.

Also convicted were senior police and Valley kingpin, Gerry Bellino, who was sentenced to seven years in prison for paying bribes.

As for Jack "the Bagman" Herbert, he escaped jail by rolling over and telling all to the inquiry.

The Moonlight State, the 1987 report that prompted the Fitzgerald Inquiry, can be viewed in full on the Four Corners website.