Justin Timberlake makes surprise cameo in Jessica Biel's TV series Candy

Justin Timberlake makes a surprise appearance in his wife Jessica Biel's new TV series, Candy.

In episode four of the Hulu true-crime show, the singer-songwriter takes on the part of Deputy Steve Deffibaugh, a police officer who investigated Candy Montgomery, as played by Biel, who was accused of brutally murdering her best friend, Betty Gore (Melanie Lynskey) in 1980s Texas.

Speaking to Entertainment Tonight about the cameo, Biel explained that Timberlake offered to take on the role after he read the script.

"He said, 'Oh, who's playing this character?' I said, 'Oh, I don't know, probably somebody local. We don't have any money left,'" she recalled. "And he goes, 'I want to play it.'"

After the episode aired, Biel took to Instagram to share several photos of herself and her husband in full costume.

"Watch out, Candy. There's a new sheriff in town," she captioned the snaps, while Timberlake added: "Belly's fake, hair's fake, mustache is real. Meet Diffy."

In addition, Lynskey's husband Jason Ritter signed on to play Deffibaugh's partner.

"They were so brilliant together. Clearly, Jason is a comedic genius and Justin is in his own right as well. And the way they work off each other and the improv that they did, it was amazing to see," Biel gushed.